Skip to content

Commit abaf113

Browse files
committed
test: round to 2 decimal places
1 parent 01a5907 commit abaf113

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

tests/io/kp/test_kp_niemegk.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ def test_process_single_file(self):
143143
assert len(df) == 2
144144

145145
expected_values = [
146-
3.667,
147-
2.333,
146+
3.67,
147+
2.33,
148148
]
149149

150150
for actual, expected in zip(df["kp"].values, expected_values):
151-
assert np.isclose(actual, expected, atol=0.001)
151+
assert np.isclose(actual, expected, atol=0.0)
152152

153153
finally:
154154
shutil.rmtree(temp_dir, ignore_errors=True)

tests/io/kp/test_kp_swpc.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ def test_read_with_download(self, kp_swpc_instance):
9292
assert data["kp"].max() <= 9
9393
assert data.index.tzinfo == timezone.utc
9494

95-
decimals = (data["kp"] % 1).unique()
95+
decimals = [round(x, 2) for x in (data["kp"] % 1).unique()]
9696
for decimal in decimals:
97-
assert np.isclose(decimal, 0) or np.isclose(decimal, 1 / 3) or np.isclose(decimal, 2 / 3)
97+
assert (
98+
np.isclose(decimal, 0) or np.isclose(decimal, round(1 / 3, 2)) or np.isclose(decimal, round(2 / 3, 2))
99+
)
98100

99101
def test_read_exceeding_three_days(self, kp_swpc_instance):
100102
start_time = datetime.now(timezone.utc)

0 commit comments

Comments
 (0)