Skip to content

Commit d634c97

Browse files
authored
Merge pull request #73 from ThibTrip/fix-for-pandas2.0-failing-tests
Fixes failing tests for pandas 2.0
2 parents e317494 + beab0de commit d634c97

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

pangres/tests/test_con_and_trans_control.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ def run_test_transaction(engine, schema, trans_op):
8383
# depends on the database type and other factors)
8484
if trans_op == 'commit':
8585
df_db = select_table(engine=engine, schema=schema, table_name=table_name, index_col='ix')
86-
pd.testing.assert_frame_equal(df_db.sort_index(),
87-
pd.DataFrame(index=pd.Index(['bar', 'foo'], name='ix')))
86+
# this simple check will be enough since we do not have values, only an index
87+
assert df_db.index.sort_values().tolist() == ['bar', 'foo']
88+
assert df_db.index.name == 'ix'
89+
8890
elif trans_op == 'rollback':
8991
df_db = select_table(engine=engine, schema=schema, table_name=table_name, error_if_missing=False)
9092
# no table or an empty table
@@ -117,8 +119,10 @@ async def run_test_transaction_async(engine, schema, trans_op):
117119
# depends on the database type and other factors)
118120
if trans_op == 'commit':
119121
df_db = await aselect_table(engine=engine, schema=schema, table_name=table_name, index_col='ix')
120-
pd.testing.assert_frame_equal(df_db.sort_index(),
121-
pd.DataFrame(index=pd.Index(['bar', 'foo'], name='ix')))
122+
# this simple check will be enough since we do not have values, only an index
123+
assert df_db.index.sort_values().tolist() == ['bar', 'foo']
124+
assert df_db.index.name == 'ix'
125+
122126
elif trans_op == 'rollback':
123127
df_db = await aselect_table(engine=engine, schema=schema, table_name=table_name, error_if_missing=False)
124128
# no table or an empty table
@@ -157,7 +161,9 @@ def run_test_commit_as_you_go(engine, schema):
157161
# the table in the db should be equal to the initial df as the second
158162
# operation was rolled back
159163
df_db = select_table(engine=engine, schema=schema, table_name=table_name, index_col='ix')
160-
pd.testing.assert_frame_equal(df_db, df)
164+
# this simple check will be enough since we do not have values, only an index
165+
assert df_db.index.sort_values().tolist() == df.index.sort_values().tolist()
166+
assert df_db.index.name == 'ix'
161167

162168

163169
@adrop_table_between_tests(table_name=TableNames.COMMIT_AS_YOU_GO)
@@ -180,7 +186,9 @@ async def run_test_commit_as_you_go_async(engine, schema):
180186
# the table in the db should be equal to the initial df as the second
181187
# operation was rolled back
182188
df_db = await aselect_table(engine=engine, schema=schema, table_name=table_name, index_col='ix')
183-
pd.testing.assert_frame_equal(df_db, df)
189+
# this simple check will be enough since we do not have values, only an index
190+
assert df_db.index.sort_values().tolist() == df.index.sort_values().tolist()
191+
assert df_db.index.name == 'ix'
184192

185193

186194
# -

0 commit comments

Comments
 (0)