test(python): rename tests & add column count test

This commit is contained in:
rzmk 2024-06-25 21:19:24 -04:00
parent 1e7c4a1569
commit 5b8c057e5d
No known key found for this signature in database

View file

@ -2,12 +2,12 @@ import czv
import pytest import pytest
from .test_data import test_data from .test_data import test_data
class TestCountFunc: class TestRowCount:
@pytest.mark.parametrize( @pytest.mark.parametrize(
"file_name,expected", "file_name,expected",
[("fruits.csv", 3), ("constituents_altnames.csv", 33971)], [("fruits.csv", 3), ("constituents_altnames.csv", 33971)],
) )
def test_count(self, file_name, expected): def test_row_count(self, file_name, expected):
"""Count the total number of non-header rows.""" """Count the total number of non-header rows."""
result = czv.row_count(file_path=test_data[file_name]) result = czv.row_count(file_path=test_data[file_name])
@ -17,8 +17,19 @@ class TestCountFunc:
"file_name,expected", "file_name,expected",
[("fruits.csv", 4), ("constituents_altnames.csv", 33972)], [("fruits.csv", 4), ("constituents_altnames.csv", 33972)],
) )
def test_include_header_row(self, file_name, expected): def test_row_count_include_header_row(self, file_name, expected):
"""Count the total number of rows including the header row.""" """Count the total number of rows including the header row."""
result = czv.row_count(file_path=test_data[file_name], include_header_row=True) result = czv.row_count(file_path=test_data[file_name], include_header_row=True)
assert result == expected assert result == expected
class TestColumnCount:
@pytest.mark.parametrize(
"file_name,expected",
[("fruits.csv", 2), ("constituents_altnames.csv", 6)],
)
def test_column_count(self, file_name, expected):
"""Count the total number of columns."""
result = czv.column_count(file_path=test_data[file_name])
assert result == expected