summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-01-29 20:21:56 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-01-29 20:21:56 (GMT)
commit64a5562f4c92b6b99762f71d3506b4b0644cec70 (patch)
treec8fb769f9287f2f32ef8d35650aecfae0b0f4992 /Lib/test/test_inspect.py
parentf7209225bbc386aa3dd49e5c2c601cd0906ccb53 (diff)
parentbd41d1b14c03e76c6ebf396720eddba60f00c8dc (diff)
downloadcpython-64a5562f4c92b6b99762f71d3506b4b0644cec70.zip
cpython-64a5562f4c92b6b99762f71d3506b4b0644cec70.tar.gz
cpython-64a5562f4c92b6b99762f71d3506b4b0644cec70.tar.bz2
Issue #17071: Signature.bind() now works when one of the keyword arguments is named self.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r--Lib/test/test_inspect.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 0ab414d..66ffe91 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -2241,6 +2241,16 @@ class TestSignatureBind(unittest.TestCase):
with self.assertRaisesRegex(TypeError, "parameter is positional only"):
self.call(test, a_po=1, b_po=2)
+ def test_signature_bind_with_self_arg(self):
+ # Issue #17071: one of the parameters is named "self
+ def test(a, self, b):
+ pass
+ sig = inspect.signature(test)
+ ba = sig.bind(1, 2, 3)
+ self.assertEqual(ba.args, (1, 2, 3))
+ ba = sig.bind(1, self=2, b=3)
+ self.assertEqual(ba.args, (1, 2, 3))
+
class TestBoundArguments(unittest.TestCase):
def test_signature_bound_arguments_unhashable(self):