summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_capi.py
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-02-09 06:15:29 (GMT)
committerLarry Hastings <larry@hastings.org>2014-02-09 06:15:29 (GMT)
commit2623c8c23cead505a78ec416072223552e94727e (patch)
tree9ac129d693fd98eb33d548bc836d89e006bbb937 /Lib/test/test_capi.py
parent09f08fe2483aaefba367c6b0b4654c3490a32c42 (diff)
downloadcpython-2623c8c23cead505a78ec416072223552e94727e.zip
cpython-2623c8c23cead505a78ec416072223552e94727e.tar.gz
cpython-2623c8c23cead505a78ec416072223552e94727e.tar.bz2
Issue #20530: Argument Clinic's signature format has been revised again.
The new syntax is highly human readable while still preventing false positives. The syntax also extends Python syntax to denote "self" and positional-only parameters, allowing inspect.Signature objects to be totally accurate for all supported builtins in Python 3.4.
Diffstat (limited to 'Lib/test/test_capi.py')
-rw-r--r--Lib/test/test_capi.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 10e8c4e..ba7c38d 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -126,20 +126,29 @@ class CAPITest(unittest.TestCase):
self.assertEqual(_testcapi.docstring_no_signature.__text_signature__, None)
self.assertEqual(_testcapi.docstring_with_invalid_signature.__doc__,
- "sig= (module, boo)\n"
+ "docstring_with_invalid_signature($module, /, boo)\n"
"\n"
"This docstring has an invalid signature."
)
self.assertEqual(_testcapi.docstring_with_invalid_signature.__text_signature__, None)
+ self.assertEqual(_testcapi.docstring_with_invalid_signature2.__doc__,
+ "docstring_with_invalid_signature2($module, /, boo)\n"
+ "\n"
+ "--\n"
+ "\n"
+ "This docstring also has an invalid signature."
+ )
+ self.assertEqual(_testcapi.docstring_with_invalid_signature2.__text_signature__, None)
+
self.assertEqual(_testcapi.docstring_with_signature.__doc__,
"This docstring has a valid signature.")
- self.assertEqual(_testcapi.docstring_with_signature.__text_signature__, "(module, sig)")
+ self.assertEqual(_testcapi.docstring_with_signature.__text_signature__, "($module, /, sig)")
self.assertEqual(_testcapi.docstring_with_signature_and_extra_newlines.__doc__,
- "This docstring has a valid signature and some extra newlines.")
+ "\nThis docstring has a valid signature and some extra newlines.")
self.assertEqual(_testcapi.docstring_with_signature_and_extra_newlines.__text_signature__,
- "(module, parameter)")
+ "($module, /, parameter)")
@unittest.skipUnless(threading, 'Threading required for this test.')