Skip to content

Commit

Permalink
test(helper): add atol as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
MetzkerLior committed Jun 7, 2024
1 parent aebd6df commit 8063591
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pandas


def assertDataFramesEqual(self: unittest.TestCase, first: pandas.DataFrame, second: pandas.DataFrame) -> bool:
def assertDataFramesEqual(self: unittest.TestCase, first: pandas.DataFrame, second: pandas.DataFrame, atol=1.e-8) -> bool:
for index, column in enumerate(first.columns):
self.assertEqual(first.dtypes.iloc[index], second.dtypes.iloc[index], f"{column}: type mismatch between dataframes")

Expand All @@ -21,7 +21,7 @@ def assertDataFramesEqual(self: unittest.TestCase, first: pandas.DataFrame, seco
self.assertTrue(numpy.allclose(
first[~first[column].isna()][column],
second[~second[column].isna()][column],
atol=1.e-7,
atol=atol,
equal_nan=True
), f"{column}: not all non-NaN are equal in comparing float")

Expand Down

0 comments on commit 8063591

Please sign in to comment.