summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_argparse.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-05-26 07:40:09 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-05-26 07:40:09 (GMT)
commitfb8899a597c5ef39706215a894fc8c5f5dbf85bc (patch)
tree01ef4ab677dc3fb8edb3a2c36202f21ca27ff0a7 /Lib/test/test_argparse.py
parentf643b9a9c79928c4ca28d895e7e9a1dcf827cf00 (diff)
downloadcpython-fb8899a597c5ef39706215a894fc8c5f5dbf85bc.zip
cpython-fb8899a597c5ef39706215a894fc8c5f5dbf85bc.tar.gz
cpython-fb8899a597c5ef39706215a894fc8c5f5dbf85bc.tar.bz2
Issue #21481: Teach argparse equality tests to return NotImplemented when comparing to unknown types.
Diffstat (limited to 'Lib/test/test_argparse.py')
-rw-r--r--Lib/test/test_argparse.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py
index fdf2b67..0df66ad 100644
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -4453,6 +4453,12 @@ class TestNamespace(TestCase):
self.assertTrue(ns2 != ns3)
self.assertTrue(ns2 != ns4)
+ def test_equality_returns_notimplemeted(self):
+ # See issue 21481
+ ns = argparse.Namespace(a=1, b=2)
+ self.assertIs(ns.__eq__(None), NotImplemented)
+ self.assertIs(ns.__ne__(None), NotImplemented)
+
# ===================
# File encoding tests