Add pytest for license scriptlet

main
Jeff Moe 2023-11-24 18:21:44 -07:00
parent 38a8c9d29b
commit 83310747f5
2 changed files with 26 additions and 0 deletions

View File

@ -3,3 +3,4 @@ tqdm
pandas
pathlib
termcolor
pytest

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
import pytest
import pandas as pd
def test_get_records():
df = pd.DataFrame({"a": [1, 2, 3]})
assert get_records(df, "-1-2").equals(pd.DataFrame({"a": [1, 2]}))
assert get_records(df, "1").equals(pd.DataFrame({"a": [1]}))
def test_print_records():
df = pd.DataFrame({"a": [1, 2]})
# You can mock print function and check that it was called with correct arguments
pass
def test_print_unique_licenses():
df = pd.DataFrame({"license": ["MIT", "GPL", "Apache"]})
# Same as above, you can mock print function and check that it was called with sorted licenses
pass