2015-09-04 21:42:12 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from __future__ import print_function
|
2016-01-17 21:36:36 +00:00
|
|
|
import sys
|
|
|
|
import pydoc
|
2015-07-29 15:51:54 +00:00
|
|
|
|
2016-01-17 21:36:36 +00:00
|
|
|
sys.path.append('.')
|
2015-07-29 15:51:54 +00:00
|
|
|
|
2016-05-08 12:34:09 +00:00
|
|
|
from example import kw_func, kw_func2, kw_func3, kw_func4, call_kw_func
|
2016-05-10 14:59:01 +00:00
|
|
|
from example import args_function, args_kwargs_function
|
2015-07-29 15:51:54 +00:00
|
|
|
|
|
|
|
print(pydoc.render_doc(kw_func, "Help on %s"))
|
|
|
|
print(pydoc.render_doc(kw_func2, "Help on %s"))
|
2016-01-17 21:36:36 +00:00
|
|
|
print(pydoc.render_doc(kw_func3, "Help on %s"))
|
2016-01-17 21:36:43 +00:00
|
|
|
print(pydoc.render_doc(kw_func4, "Help on %s"))
|
2015-07-29 15:51:54 +00:00
|
|
|
|
|
|
|
kw_func(5, 10)
|
2016-01-17 21:36:36 +00:00
|
|
|
kw_func(5, y=10)
|
|
|
|
kw_func(y=10, x=5)
|
2015-07-29 15:51:54 +00:00
|
|
|
|
|
|
|
kw_func2()
|
|
|
|
|
|
|
|
kw_func2(5)
|
|
|
|
kw_func2(x=5)
|
|
|
|
|
|
|
|
kw_func2(y=10)
|
|
|
|
|
|
|
|
kw_func2(5, 10)
|
|
|
|
kw_func2(x=5, y=10)
|
2016-01-17 21:36:36 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
kw_func2(x=5, y=10, z=12)
|
|
|
|
except Exception as e:
|
|
|
|
print("Caught expected exception: " + str(e))
|
2016-01-17 21:36:43 +00:00
|
|
|
|
|
|
|
kw_func4()
|
2016-05-10 14:59:01 +00:00
|
|
|
kw_func4(myList=[1, 2, 3])
|
2016-05-08 12:34:09 +00:00
|
|
|
|
|
|
|
call_kw_func(kw_func2)
|
2016-05-10 14:59:01 +00:00
|
|
|
|
|
|
|
args_function('arg1_value', 'arg2_value', 3)
|
|
|
|
args_kwargs_function('arg1_value', 'arg2_value', arg3='arg3_value', arg4=4)
|