From 0c84024c16a1e0fe11a316b7acb8f99ad17e4faa Mon Sep 17 00:00:00 2001 From: Willie Blan Date: Sun, 22 Dec 2019 18:34:22 -0600 Subject: [PATCH 1/3] Fixing pandas/tests/indexes/multi/test_analytics.py to utilize python3 format strings --- pandas/tests/indexes/multi/test_analytics.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pandas/tests/indexes/multi/test_analytics.py b/pandas/tests/indexes/multi/test_analytics.py index 36152bc4b60cd..8bf1754ef0809 100644 --- a/pandas/tests/indexes/multi/test_analytics.py +++ b/pandas/tests/indexes/multi/test_analytics.py @@ -277,7 +277,7 @@ def test_map(idx): def test_map_dictlike(idx, mapper): if isinstance(idx, (pd.CategoricalIndex, pd.IntervalIndex)): - pytest.skip("skipping tests for {}".format(type(idx))) + pytest.skip(f"skipping tests for {type(idx)}") identity = mapper(idx.values, idx) @@ -330,13 +330,13 @@ def test_numpy_ufuncs(idx, func): if _np_version_under1p17: expected_exception = AttributeError - msg = "'tuple' object has no attribute '{}'".format(func.__name__) + msg = f"'tuple' object has no attribute '{func.__name__}'" else: expected_exception = TypeError msg = ( - "loop of ufunc does not support argument 0 of type tuple which" - " has no callable {} method" - ).format(func.__name__) + f"loop of ufunc does not support argument 0 of type tuple which" + f" has no callable {func.__name__} method" + ) with pytest.raises(expected_exception, match=msg): func(idx) @@ -348,9 +348,9 @@ def test_numpy_ufuncs(idx, func): ) def test_numpy_type_funcs(idx, func): msg = ( - "ufunc '{}' not supported for the input types, and the inputs" - " could not be safely coerced to any supported types according to" - " the casting rule ''safe''" - ).format(func.__name__) + f"ufunc '{func.__name__}' not supported for the input types, and the inputs" + f" could not be safely coerced to any supported types according to" + f" the casting rule ''safe''" + ) with pytest.raises(TypeError, match=msg): func(idx) From 3857008beccd18d6193df36ffbf4d7012f1de726 Mon Sep 17 00:00:00 2001 From: William Blan Date: Mon, 23 Dec 2019 05:39:10 -0600 Subject: [PATCH 2/3] Update pandas/tests/indexes/multi/test_analytics.py Co-Authored-By: William Ayd --- pandas/tests/indexes/multi/test_analytics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/indexes/multi/test_analytics.py b/pandas/tests/indexes/multi/test_analytics.py index 8bf1754ef0809..704ccab81ce3f 100644 --- a/pandas/tests/indexes/multi/test_analytics.py +++ b/pandas/tests/indexes/multi/test_analytics.py @@ -334,7 +334,7 @@ def test_numpy_ufuncs(idx, func): else: expected_exception = TypeError msg = ( - f"loop of ufunc does not support argument 0 of type tuple which" + "loop of ufunc does not support argument 0 of type tuple which" f" has no callable {func.__name__} method" ) with pytest.raises(expected_exception, match=msg): From 2f96cf08ab9f7729e4e6813fb583833397bb7e38 Mon Sep 17 00:00:00 2001 From: William Blan Date: Mon, 23 Dec 2019 05:43:45 -0600 Subject: [PATCH 3/3] Update test_analytics.py --- pandas/tests/indexes/multi/test_analytics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/indexes/multi/test_analytics.py b/pandas/tests/indexes/multi/test_analytics.py index 704ccab81ce3f..a6d08c845d941 100644 --- a/pandas/tests/indexes/multi/test_analytics.py +++ b/pandas/tests/indexes/multi/test_analytics.py @@ -349,8 +349,8 @@ def test_numpy_ufuncs(idx, func): def test_numpy_type_funcs(idx, func): msg = ( f"ufunc '{func.__name__}' not supported for the input types, and the inputs" - f" could not be safely coerced to any supported types according to" - f" the casting rule ''safe''" + " could not be safely coerced to any supported types according to" + " the casting rule ''safe''" ) with pytest.raises(TypeError, match=msg): func(idx)