Skip to content

Commit cf20f21

Browse files
grusevGeorgi Rusev
authored and
Georgi Rusev
committed
fix handling of empty DF in pandas 1.0 (#2010)
#### Reference Issues/PRs <!--Example: Fixes #1234. See also #3456.--> Fix test failure for new merged readd_batch(), due to problem in Pandas 1.x when arctic returns empty DF #### What does this implement or fix? #### Any other comments? #### Checklist <details> <summary> Checklist for code changes... </summary> - [ ] Have you updated the relevant docstrings, documentation and copyright notice? - [ ] Is this contribution tested against [all ArcticDB's features](../docs/mkdocs/docs/technical/contributing.md)? - [ ] Do all exceptions introduced raise appropriate [error messages](https://docs.arcticdb.io/error_messages/)? - [ ] Are API changes highlighted in the PR description? - [ ] Is the PR labelled as enhancement or bug so it appears in autogenerated release notes? </details> <!-- Thanks for contributing a Pull Request to ArcticDB! Please ensure you have taken a look at: - ArcticDB's Code of Conduct: https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md - ArcticDB's Contribution Licensing: https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing --> Co-authored-by: Georgi Rusev <Georgi Rusev>
1 parent 7b51cf0 commit cf20f21

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

python/tests/integration/arcticdb/test_read_batch_more.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,9 @@ def test_read_batch_multiple_symbols_all_types_data_query_metadata(arctic_librar
312312
# Filter fload and string condition
313313
assert_frame_equal_rebuild_index_first(dfqapplied, batch[7].data)
314314
else:
315-
with pytest.raises(AssertionError):
316-
assert_frame_equal_rebuild_index_first(dfqapplied, batch[7].data)
315+
# Special handling
316+
assert dfqapplied.shape[0] == batch[7].data.shape[0]
317+
assert dfqapplied.columns.to_list() == batch[7].data.columns.to_list()
317318

318319
def test_read_batch_multiple_wrong_things_at_once(arctic_library):
319320
"""
@@ -458,7 +459,11 @@ def q3(q):
458459
assert_frame_equal_rebuild_index_first(df_filtered, batch[1].data)
459460
assert metadata == batch[1].metadata
460461
df_filtered = q2(df_all)[columns2]
461-
assert_frame_equal_rebuild_index_first(df_filtered, batch[2].data)
462+
## When we have [] df then the assertion would be different due to
463+
## a problem in pandas 1.x . We affirm that reurned columns are same
464+
## and the size of frame is same
465+
assert df_filtered.shape[0] == batch[2].data.shape[0]
466+
assert df_filtered.columns.to_list() == batch[2].data.columns.to_list()
462467
assert metadata == batch[2].metadata
463468
df_filtered = q3(df_all)[columns_one_1]
464469
assert_frame_equal_rebuild_index_first(df_filtered, batch[3].data)

0 commit comments

Comments
 (0)