Skip to content

Commit

Permalink
extra assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Oct 10, 2024
1 parent e08a180 commit 70294fa
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_ddlpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def test_locations(locations):
# the number of rows is the number of stations, so will change over time
assert locations.shape[0] > 1

# check if index is station code
assert locations.index.name == "Code"
assert isinstance(locations.index, pd.Index)
assert isinstance(locations.index[0], str)

# check presence of columns
expected_columns = ['Coordinatenstelsel', 'X', 'Y', 'Naam',
'Parameter_Wat_Omschrijving',
'Compartiment.Code', 'Compartiment.Omschrijving',
Expand All @@ -55,11 +61,6 @@ def test_locations(locations):
'Hoedanigheid.Code', 'Hoedanigheid.Omschrijving',
'Parameter.Code', 'Parameter.Omschrijving',
'Groepering.Code', 'Groepering.Omschrijving']

# check if index is station code
assert locations.index.name == "Code"

# check presence of columns
for colname in expected_columns:
assert colname in locations.columns

Expand Down Expand Up @@ -92,8 +93,10 @@ def test_locations_extended():
def test_measurements(measurements):
assert measurements.shape[0] > 1

# check if index is station code
# check if index is time and check dtype
assert measurements.index.name == "time"
assert isinstance(measurements.index, pd.DatetimeIndex)
assert isinstance(measurements.index[0], pd.Timestamp)

# check if columns are present that are transfered from the locations dataframe
expected_columns = ['Coordinatenstelsel', 'X', 'Y', 'Naam',
Expand Down

0 comments on commit 70294fa

Please sign in to comment.