mirror of
https://github.com/rzmk/czv.git
synced 2025-12-19 08:09:24 +00:00
feat: add czv, czv-wasm, and czv-python (init release)
This commit is contained in:
commit
9799ab694b
40 changed files with 70383 additions and 0 deletions
0
czv-python/tests/__init__.py
Normal file
0
czv-python/tests/__init__.py
Normal file
33972
czv-python/tests/data/constituents_altnames.csv
Normal file
33972
czv-python/tests/data/constituents_altnames.csv
Normal file
File diff suppressed because it is too large
Load diff
4
czv-python/tests/data/fruits.csv
Normal file
4
czv-python/tests/data/fruits.csv
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fruit,price
|
||||
apple,2.50
|
||||
banana,3.00
|
||||
strawberry,1.50
|
||||
|
24
czv-python/tests/test_count.py
Normal file
24
czv-python/tests/test_count.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import czv
|
||||
import pytest
|
||||
from .test_data import test_data
|
||||
|
||||
class TestCountFunc:
|
||||
@pytest.mark.parametrize(
|
||||
"file_name,expected",
|
||||
[("fruits.csv", 3), ("constituents_altnames.csv", 33971)],
|
||||
)
|
||||
def test_count(self, file_name, expected):
|
||||
"""Count the total number of non-header rows."""
|
||||
|
||||
result = czv.row_count(test_data[file_name].read_text())
|
||||
assert result == expected
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"file_name,expected",
|
||||
[("fruits.csv", 4), ("constituents_altnames.csv", 33972)],
|
||||
)
|
||||
def test_include_header_row(self, file_name, expected):
|
||||
"""Count the total number of rows including the header row."""
|
||||
|
||||
result = czv.row_count(test_data[file_name].read_text(), include_header_row=True)
|
||||
assert result == expected
|
||||
7
czv-python/tests/test_data.py
Normal file
7
czv-python/tests/test_data.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import pathlib
|
||||
|
||||
data_path = pathlib.Path(__file__).parent.resolve().joinpath("data")
|
||||
test_data = {
|
||||
file_name: data_path.joinpath(file_name)
|
||||
for file_name in ["fruits.csv", "constituents_altnames.csv"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue