summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_extcall.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index f1fff0a..a5af50b 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -1,3 +1,4 @@
+
"""Doctest for method/function calls.
We're going the use these types for extra testing
@@ -65,17 +66,17 @@ Verify clearing of SF bug #733667
>>> g()
Traceback (most recent call last):
...
- TypeError: g() takes at least 1 positional argument (0 given)
+ TypeError: g() takes at least 1 argument (0 given)
>>> g(*())
Traceback (most recent call last):
...
- TypeError: g() takes at least 1 positional argument (0 given)
+ TypeError: g() takes at least 1 argument (0 given)
>>> g(*(), **{})
Traceback (most recent call last):
...
- TypeError: g() takes at least 1 positional argument (0 given)
+ TypeError: g() takes at least 1 argument (0 given)
>>> g(1)
1 () {}
@@ -261,13 +262,31 @@ the function call setup. See <http://bugs.python.org/issue2016>.
... print(a,b)
>>> f(**x)
1 2
+
+A obscure message:
+
+ >>> def f(a, b):
+ ... pass
+ >>> f(b=1)
+ Traceback (most recent call last):
+ ...
+ TypeError: f() takes exactly 2 arguments (1 given)
+
+The number of arguments passed in includes keywords:
+
+ >>> def f(a):
+ ... pass
+ >>> f(6, a=4, *(1, 2, 3))
+ Traceback (most recent call last):
+ ...
+ TypeError: f() takes exactly 1 argument (5 given)
"""
+import sys
from test import support
def test_main():
- from test import test_extcall # self import
- support.run_doctest(test_extcall, True)
+ support.run_doctest(sys.modules[__name__], True)
if __name__ == '__main__':
test_main()