From ae8c94206f1509a11aa47488fd110c430711f97e Mon Sep 17 00:00:00 2001 From: Debian Science Team Date: Sun, 28 Jun 2020 21:47:22 +0100 Subject: [PATCH] Don't use 'is' with literals It causes a SyntaxWarning on install, and possibly undefined test results Author: Rebecca N. Palmer Bug-Debian: https://bugs.debian.org/956021 Forwarded: https://github.com/pandas-dev/pandas/pull/33322 Gbp-Pq: Name fix_is_warnings.patch --- pandas/tests/frame/test_alter_axes.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pandas/tests/frame/test_alter_axes.py b/pandas/tests/frame/test_alter_axes.py index a6fd980f..cb3bb22a 100644 --- a/pandas/tests/frame/test_alter_axes.py +++ b/pandas/tests/frame/test_alter_axes.py @@ -236,9 +236,16 @@ class TestDataFrameAlterAxes: # need to adapt first drop for case that both keys are 'A' -- # cannot drop the same column twice; - # use "is" because == would give ambiguous Boolean error for containers + # plain == would give ambiguous Boolean error for containers first_drop = ( - False if (keys[0] is "A" and keys[1] is "A") else drop # noqa: F632 + False + if ( + type(keys[0]) == str + and keys[0] == "A" + and type(keys[1]) == str + and keys[1] == "A" + ) + else drop ) # to test against already-tested behaviour, we add sequentially, # hence second append always True; must wrap keys in list, otherwise -- 2.30.2