Skip to content

Commit 912d523

Browse files
committed
TST: separate out test_append_to_multiple_dropna to two tests; when drop=False this is sometimes failing
1 parent a2625ba commit 912d523

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

pandas/tests/io/test_pytables.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -4052,6 +4052,7 @@ def test_append_to_multiple_dropna(self):
40524052
df = concat([df1, df2], axis=1)
40534053

40544054
with ensure_clean_store(self.path) as store:
4055+
40554056
# dropna=True should guarantee rows are synchronized
40564057
store.append_to_multiple(
40574058
{'df1': ['A', 'B'], 'df2': None}, df, selector='df1',
@@ -4062,14 +4063,27 @@ def test_append_to_multiple_dropna(self):
40624063
tm.assert_index_equal(store.select('df1').index,
40634064
store.select('df2').index)
40644065

4066+
@pytest.mark.xfail(run=False,
4067+
reason="append_to_multiple_dropna_false "
4068+
"is not raising as failed")
4069+
def test_append_to_multiple_dropna_false(self):
4070+
df1 = tm.makeTimeDataFrame()
4071+
df2 = tm.makeTimeDataFrame().rename(columns=lambda x: "%s_2" % x)
4072+
df1.iloc[1, df1.columns.get_indexer(['A', 'B'])] = np.nan
4073+
df = concat([df1, df2], axis=1)
4074+
4075+
with ensure_clean_store(self.path) as store:
4076+
40654077
# dropna=False shouldn't synchronize row indexes
40664078
store.append_to_multiple(
4067-
{'df1': ['A', 'B'], 'df2': None}, df, selector='df1',
4079+
{'df1a': ['A', 'B'], 'df2a': None}, df, selector='df1a',
40684080
dropna=False)
4069-
self.assertRaises(
4070-
ValueError, store.select_as_multiple, ['df1', 'df2'])
4071-
assert not store.select('df1').index.equals(
4072-
store.select('df2').index)
4081+
4082+
with pytest.raises(ValueError):
4083+
store.select_as_multiple(['df1a', 'df2a'])
4084+
4085+
assert not store.select('df1a').index.equals(
4086+
store.select('df2a').index)
40734087

40744088
def test_select_as_multiple(self):
40754089

0 commit comments

Comments
 (0)