PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/python/varargs_runme.py

#
Python | 36 lines | 25 code | 10 blank | 1 comment | 8 complexity | e78b03dabde4daf9b18b8c18a71b8cb2 MD5 | raw file
 1import varargs
 2
 3if varargs.test("Hello") != "Hello":
 4    raise RuntimeError, "Failed"
 5
 6f = varargs.Foo("Greetings")
 7if f.str != "Greetings":
 8    raise RuntimeError, "Failed"
 9
10if f.test("Hello") != "Hello":
11    raise RuntimeError, "Failed"
12
13
14if varargs.test_def("Hello",1) != "Hello":
15    raise RuntimeError, "Failed"
16
17if varargs.test_def("Hello") != "Hello":
18    raise RuntimeError, "Failed"
19
20###
21if varargs.test_plenty("Hello") != "Hello":
22    raise RuntimeError, "Failed"
23
24if varargs.test_plenty("Hello", 1) != "Hello":
25    raise RuntimeError, "Failed"
26
27if varargs.test_plenty("Hello", 1, 2) != "Hello":
28    raise RuntimeError, "Failed"
29
30try:
31    varargs.test_plenty("Hello", 1, 2, 3)
32    raise RuntimeError
33except NotImplementedError:
34    pass
35except TypeError:
36    pass