2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-29 19:52:16 +00:00

Default Arguments Handling

[SVN r14786]
This commit is contained in:
Joel de Guzman
2002-08-12 14:22:36 +00:00
parent bbc90bcc9c
commit cdf49c6ac0
6 changed files with 541 additions and 23 deletions

82
test/defaults.py Normal file
View File

@@ -0,0 +1,82 @@
"""
>>> from defaults_ext import *
>>> foo(1)
'int(1); char(D); string(default); double(0); '
>>> foo(2, 'X')
'int(2); char(X); string(default); double(0); '
>>> foo(3, 'Y', "Hello World")
'int(3); char(Y); string(Hello World); double(0); '
>>> foo(4, 'Z', "Hi There", 3.3)
'int(4); char(Z); string(Hi There); double(3.3); '
>>> x = X()
>>> x.bar(1)
'int(1); char(D); string(default); double(0); '
>>> x.bar(2, 'X')
'int(2); char(X); string(default); double(0); '
>>> x.bar(3, 'Y', "Hello World")
'int(3); char(Y); string(Hello World); double(0); '
>>> x.bar(4, 'Z', "Hi There", 3.3)
'int(4); char(Z); string(Hi There); double(3.3); '
>>>
"""
def run(args = None):
import sys
import doctest
if args is not None:
sys.argv = args
return doctest.testmod(sys.modules.get(__name__))
if __name__ == '__main__':
print "running..."
import sys
sys.exit(run()[0])