Skip to content

Commit

Permalink
adding tests and docs to head and tail
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkrausse committed Feb 24, 2024
1 parent 2a4290d commit a885d11
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ of commonly used methods. The full list can be found in the API section.

* - Method
- Description
* - :py:meth:`~parsons.etl.etl.ETL.head`
- Get the first n rows of a table
* - :py:meth:`~parsons.etl.etl.ETL.tail`
- Get the last n rows of a table
* - :py:meth:`~parsons.etl.etl.ETL.add_column`
- Add a column
* - :py:meth:`~parsons.etl.etl.ETL.remove_column`
Expand Down
12 changes: 12 additions & 0 deletions test/test_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,3 +997,15 @@ def test_deduplicate(self):
tbl_expected = Table([["a", "b", "c"], [1, 2, 3], [1, 3, 2], [2, 3, 4]])
tbl.deduplicate(["a", "b"])
assert_matching_tables(tbl_expected, tbl)

def test_head(self):
tbl = Table([["a", "b"], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10]])
tbl_expected = Table([["a", "b"], [1, 2], [3, 4]])
tbl.head(2)
assert_matching_tables(tbl_expected, tbl)

def test_tail(self):
tbl = Table([["a", "b"], [1, 2], [3, 4], [5, 6], [7, 8], [9, 10]])
tbl_expected = Table([["a", "b"], [7, 8], [9, 10]])
tbl.tail(2)
assert_matching_tables(tbl_expected, tbl)

0 comments on commit a885d11

Please sign in to comment.