From aad6650def310d57efb500df974c3751a5b1af4f Mon Sep 17 00:00:00 2001 From: Maxim Ivanov Date: Wed, 7 Apr 2021 15:15:47 +0700 Subject: [PATCH 1/2] TST: add test on checking objects to concatenate --- pandas/tests/reshape/concat/test_concat.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandas/tests/reshape/concat/test_concat.py b/pandas/tests/reshape/concat/test_concat.py index 7b520171379c3..89dbabce207a5 100644 --- a/pandas/tests/reshape/concat/test_concat.py +++ b/pandas/tests/reshape/concat/test_concat.py @@ -599,3 +599,8 @@ def test_concat_repeated_keys(keys, integrity): tuples = list(zip(keys, ["a", "b", "c"])) expected = Series([1, 2, 3], index=MultiIndex.from_tuples(tuples)) tm.assert_series_equal(result, expected) + + +def test_concat_no_items_raises(): + with pytest.raises(ValueError, match="No objects to concatenate"): + concat([]) From c3a00cc9870ad51ff3f92de4e36e5f2d2ffaf47d Mon Sep 17 00:00:00 2001 From: Maxim Ivanov Date: Thu, 8 Apr 2021 03:45:09 +0700 Subject: [PATCH 2/2] TST: move test to similar ones --- pandas/tests/reshape/concat/test_concat.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pandas/tests/reshape/concat/test_concat.py b/pandas/tests/reshape/concat/test_concat.py index 89dbabce207a5..55ae754761a07 100644 --- a/pandas/tests/reshape/concat/test_concat.py +++ b/pandas/tests/reshape/concat/test_concat.py @@ -344,6 +344,10 @@ def test_concat_single_with_key(self): expected = concat([df, df], keys=["foo", "bar"]) tm.assert_frame_equal(result, expected[:10]) + def test_concat_no_items_raises(self): + with pytest.raises(ValueError, match="No objects to concatenate"): + concat([]) + def test_concat_exclude_none(self): df = DataFrame(np.random.randn(10, 4)) @@ -599,8 +603,3 @@ def test_concat_repeated_keys(keys, integrity): tuples = list(zip(keys, ["a", "b", "c"])) expected = Series([1, 2, 3], index=MultiIndex.from_tuples(tuples)) tm.assert_series_equal(result, expected) - - -def test_concat_no_items_raises(): - with pytest.raises(ValueError, match="No objects to concatenate"): - concat([])