Skip to content

Commit

Permalink
Add test of reading metadata
Browse files Browse the repository at this point in the history
- Add Git LFS configuration, .gitattributes
- Add metadata specimen
  • Loading branch information
khaeru committed Sep 6, 2024
1 parent 342dc2e commit cff329d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Reduce the number of merge/rebase conflicts
doc/whatsnew.rst merge=union
# Git LFS
*.xlsx filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions transport_data/data/tests/metadata-input.xlsx
Git LFS file not shown
24 changes: 24 additions & 0 deletions transport_data/tests/test_org.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
from transport_data.org import get_agencyscheme, refresh
from transport_data.org.metadata import read_workbook, summarize_metadataset


def test_get_agencyscheme() -> None:
get_agencyscheme()


def test_read_workbook(test_data_path) -> None:
# Function runs successfully
result = read_workbook(test_data_path.joinpath("metadata-input.xlsx"))

# Result has a certain number of metadata reports
assert 47 == len(result.report)


def test_summarize_metadataset(capsys, test_data_path) -> None:
mds = read_workbook(test_data_path.joinpath("metadata-input.xlsx"))

# Function runs successfully
summarize_metadataset(mds)

captured = capsys.readouterr()
# pathlib.Path("debug.txt").write_text(captured.out) # DEBUG Write to a file

# Output contains certain text
assert "MEASURE: 40 unique values" in captured.out

# TODO expand with further assertions


def test_refresh() -> None:
refresh()

0 comments on commit cff329d

Please sign in to comment.