aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test
diff options
context:
space:
mode:
authorRupert Tombs <rupert.tombs@gmail.com>2021-07-07 14:28:09 +0100
committerGitHub <noreply@github.com>2021-07-07 22:28:09 +0900
commit6bd3ecfc272b122b55a6adec50dd7a7c868f262f (patch)
treead92100dff9d7506a6499f0e8fb18b74111a3e80 /Lib/test
parent8363c53369a582ff9ae4e797a80cdce12624a278 (diff)
downloadcpython-6bd3ecfc272b122b55a6adec50dd7a7c868f262f.tar.gz
cpython-6bd3ecfc272b122b55a6adec50dd7a7c868f262f.zip
bpo-44558: Match countOf `is`/`==` treatment to c (GH-27007)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_operator.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index d50306b7f1e..b9b8f155826 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -153,6 +153,11 @@ class OperatorTestCase:
self.assertRaises(ZeroDivisionError, operator.countOf, BadIterable(), 1)
self.assertEqual(operator.countOf([1, 2, 1, 3, 1, 4], 3), 1)
self.assertEqual(operator.countOf([1, 2, 1, 3, 1, 4], 5), 0)
+ # is but not ==
+ nan = float("nan")
+ self.assertEqual(operator.countOf([nan, nan, 21], nan), 2)
+ # == but not is
+ self.assertEqual(operator.countOf([{}, 1, {}, 2], {}), 2)
def test_delitem(self):
operator = self.module