summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_argparse.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-05-26 07:43:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-05-26 07:43:27 (GMT)
commitdea46ec9654a6412e74a6f8dfbdf97ff97516670 (patch)
tree6e157f543c738ecdf463a53afde142cb007a660e /Lib/test/test_argparse.py
parentdd5e53a086fcabc84ee1ac96b98057437863973a (diff)
downloadcpython-dea46ec9654a6412e74a6f8dfbdf97ff97516670.zip
cpython-dea46ec9654a6412e74a6f8dfbdf97ff97516670.tar.gz
cpython-dea46ec9654a6412e74a6f8dfbdf97ff97516670.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 5c77ec8..8a4fdb9 100644
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -4551,6 +4551,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