comparison tests/doctest.txt @ 5:a825f00fe062

add a different call method, rename the old one, and have a test for it
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 19 May 2011 12:26:29 -0700
parents
children
comparison
equal deleted inserted replaced
4:5ce55f6c8964 5:a825f00fe062
1 Test pyloader
2 =============
3
4 Test the call method::
5
6 >>> from pyloader.invoke import call
7 >>> options = {'badarg': 'bar', 'a': 7, 'b': 9, 'c': 10}
8 >>> def foo(a, b=1, c=2):
9 ... return a + 10*b + 100*c
10 >>> foo(7, 9, 10)
11 1097
12
13 You can't call methods with bad arguments OOTB in python::
14
15 >>> error = None
16 >>> try:
17 ... foo(**options)
18 ... except TypeError, e:
19 ... error = e
20 >>> type(error)
21 <type 'exceptions.TypeError'>
22
23 But you can with call::
24
25 >>> call(foo, **options)
26 1097