Skip to content

Commit

Permalink
[v0.9.1] fixed dataframe comparison logic in the presence of numerica…
Browse files Browse the repository at this point in the history
…l columns
  • Loading branch information
Guillaume227 committed Mar 18, 2024
1 parent 5c1044c commit 5634a5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions exetest/dataframe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def compare_dataframes(self, df1, df2):

cols_with_diffs = []
for col in df1.columns:
if df1[col].dtype != 'category' and np.issubdtype(df1[col].dtype, np.number):
if df1[col].dtype != 'category' and np.issubdtype(df1[col].dtype, np.number) \
and np.issubdtype(df2[col].dtype, np.number):
# use numerical comparison
if not np.allclose(df1[col].values, df2[col].values, **self.np_close_kwargs):
cols_with_diffs.append(col)
Expand All @@ -91,10 +92,11 @@ def compare_dataframes(self, df1, df2):
if self.verbose:
print('====================================')
print(f'Showing first {self.num_diffs} in cols with diff {cols_with_diffs}:')
numerical_diff_cols =[]
numerical_diff_cols = []
non_numerical_diff_cols = []
for col in cols_with_diffs:
if np.issubdtype(df1[col].dtype, np.number):
if np.issubdtype(df1[col].dtype, np.number) and \
np.issubdtype(df2[col].dtype, np.number):
numerical_diff_cols.append(col)
else:
non_numerical_diff_cols.append(col)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setup(
name='exetest', # How you named your package folder (MyLib)
packages=['exetest'], # Chose the same as "name"
version='0.9.0', # Start with a small number and increase it with every change you make
version='0.9.1', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description='A pytest-based test framework for black-box approach to testing executables', # Give a short description about your library
author='Guillaume227', # Type in your name
Expand Down

0 comments on commit 5634a5f

Please sign in to comment.