Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreenbury committed Oct 15, 2023
1 parent f4018ad commit 764e8dd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions python/tests/test_reader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from uatk_spc.reader import SPCReaderParquet as SPCReader
import pathlib
import os


def get_path():
return pathlib.Path(os.path.abspath(__file__)).parent.joinpath("data/")


TEST_REGION = "test_region"
TEST_PATH = get_path()


def test_reader():
spc = SPCReader(TEST_PATH, TEST_REGION)
print(spc.people)
assert spc.people.shape[0] == 4991


def test_merge_people_and_time_use_diaries():
spc = SPCReader(TEST_PATH, TEST_REGION)
merged = spc.merge_people_and_time_use_diaries(
{"health": ["bmi"], "demographics": ["age_years"]}, diary_type="weekday_diaries"
)
assert merged.shape == (197_397, 30)

def test_merge_people_and_households():
spc = SPCReader(TEST_PATH, TEST_REGION)
merged = spc.merge_people_and_households()
assert merged.shape == (4991, 18)

0 comments on commit 764e8dd

Please sign in to comment.