From 6a6fde1ae092bf3f08809a6ea9b3774f3acdc029 Mon Sep 17 00:00:00 2001 From: Da Xin Date: Wed, 15 Apr 2020 22:02:37 -0700 Subject: [PATCH 1/4] issue 30999 --- .../tests/arrays/boolean/test_arithmetic.py | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/pandas/tests/arrays/boolean/test_arithmetic.py b/pandas/tests/arrays/boolean/test_arithmetic.py index df4c218cbf9bf..d62a404c527f0 100644 --- a/pandas/tests/arrays/boolean/test_arithmetic.py +++ b/pandas/tests/arrays/boolean/test_arithmetic.py @@ -17,26 +17,25 @@ class TestArithmeticOps(BaseOpsUtil): def test_error(self, data, all_arithmetic_operators): # invalid ops - op = all_arithmetic_operators - s = pd.Series(data) - ops = getattr(s, op) - opa = getattr(data, op) - - # invalid scalars - with pytest.raises(TypeError): + msg="invalid scalars" + with pytest.raises(TypeError, match=msg): ops("foo") - with pytest.raises(TypeError): + with pytest.raises(TypeError, match=msg) ops(pd.Timestamp("20180101")) + # invalid array-likes - if op not in ("__mul__", "__rmul__"): - # TODO(extension) numpy's mul with object array sees booleans as numbers - with pytest.raises(TypeError): - ops(pd.Series("foo", index=s.index)) + if op not in ("__mul__", "__rmul__"): + # TODO(extension) numpy's mul with object array sees booleans as numbers + msg="invalid array-likes,numpy's mul with object array sees booleans as numbers" + with pytest.raises(TypeError, match=msg): + ops(pd.Series("foo", index=s.index)) + # 2d result = opa(pd.DataFrame({"A": s})) assert result is NotImplemented - with pytest.raises(NotImplementedError): + msg="invalid array-likes" + with pytest.raises(NotImplementedError, match=msg): opa(np.arange(len(s)).reshape(-1, len(s))) From fbb9c70fcb94f55cfbd69f6b0728bfadadd0e2f8 Mon Sep 17 00:00:00 2001 From: Devjeet Roy Date: Wed, 15 Apr 2020 22:41:29 -0700 Subject: [PATCH 2/4] Revert "issue 30999" This reverts commit 6a6fde1ae092bf3f08809a6ea9b3774f3acdc029. --- .../tests/arrays/boolean/test_arithmetic.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pandas/tests/arrays/boolean/test_arithmetic.py b/pandas/tests/arrays/boolean/test_arithmetic.py index d62a404c527f0..df4c218cbf9bf 100644 --- a/pandas/tests/arrays/boolean/test_arithmetic.py +++ b/pandas/tests/arrays/boolean/test_arithmetic.py @@ -17,25 +17,26 @@ class TestArithmeticOps(BaseOpsUtil): def test_error(self, data, all_arithmetic_operators): # invalid ops - msg="invalid scalars" - with pytest.raises(TypeError, match=msg): + op = all_arithmetic_operators + s = pd.Series(data) + ops = getattr(s, op) + opa = getattr(data, op) + + # invalid scalars + with pytest.raises(TypeError): ops("foo") - with pytest.raises(TypeError, match=msg) + with pytest.raises(TypeError): ops(pd.Timestamp("20180101")) - # invalid array-likes - if op not in ("__mul__", "__rmul__"): - # TODO(extension) numpy's mul with object array sees booleans as numbers - msg="invalid array-likes,numpy's mul with object array sees booleans as numbers" - with pytest.raises(TypeError, match=msg): - ops(pd.Series("foo", index=s.index)) - + if op not in ("__mul__", "__rmul__"): + # TODO(extension) numpy's mul with object array sees booleans as numbers + with pytest.raises(TypeError): + ops(pd.Series("foo", index=s.index)) # 2d result = opa(pd.DataFrame({"A": s})) assert result is NotImplemented - msg="invalid array-likes" - with pytest.raises(NotImplementedError, match=msg): + with pytest.raises(NotImplementedError): opa(np.arange(len(s)).reshape(-1, len(s))) From ddb88a2890d5c8f0b86b5c65de92f19233dca1f2 Mon Sep 17 00:00:00 2001 From: Da Xin Date: Wed, 15 Apr 2020 23:20:30 -0700 Subject: [PATCH 3/4] issue 29547 --- pandas/tests/util/test_assert_frame_equal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/util/test_assert_frame_equal.py b/pandas/tests/util/test_assert_frame_equal.py index fe3e1ff906919..9b4bb151c04ec 100644 --- a/pandas/tests/util/test_assert_frame_equal.py +++ b/pandas/tests/util/test_assert_frame_equal.py @@ -219,7 +219,7 @@ def test_frame_equal_unicode(df1, df2, msg, by_blocks_fixture, obj_fixture): # # Test ensures that `tm.assert_frame_equals` raises the right exception # when comparing DataFrames containing differing unicode objects. - msg = msg.format(obj=obj_fixture) + msg = f"{obj_fixture}" with pytest.raises(AssertionError, match=msg): tm.assert_frame_equal(df1, df2, by_blocks=by_blocks_fixture, obj=obj_fixture) From 9f88a29b51e044e8d75b0dfeccdbfca7efd433d4 Mon Sep 17 00:00:00 2001 From: Da Xin Date: Wed, 15 Apr 2020 23:26:37 -0700 Subject: [PATCH 4/4] issue 33428 --- pandas/plotting/_misc.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 30c5ba0ed94b6..65af0b50178bb 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -359,8 +359,7 @@ def parallel_coordinates( Examples -------- >>> from matplotlib import pyplot as plt - >>> df = pd.read_csv('https://raw.github.com/pandas-dev/pandas/master' - '/pandas/tests/data/iris.csv') + >>> df = pd.read_csv('https://raw.github.com/pandas-dev/pandas/master/pandas/tests/data/iris.csv') >>> pd.plotting.parallel_coordinates( df, 'Name', color=('#556270', '#4ECDC4', '#C7F464'))