PageRenderTime 25ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Python | 36 lines | 25 code | 10 blank | 1 comment | 11 complexity | e78b03dabde4daf9b18b8c18a71b8cb2 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. import varargs
  2. if varargs.test("Hello") != "Hello":
  3. raise RuntimeError, "Failed"
  4. f = varargs.Foo("Greetings")
  5. if f.str != "Greetings":
  6. raise RuntimeError, "Failed"
  7. if f.test("Hello") != "Hello":
  8. raise RuntimeError, "Failed"
  9. if varargs.test_def("Hello",1) != "Hello":
  10. raise RuntimeError, "Failed"
  11. if varargs.test_def("Hello") != "Hello":
  12. raise RuntimeError, "Failed"
  13. ###
  14. if varargs.test_plenty("Hello") != "Hello":
  15. raise RuntimeError, "Failed"
  16. if varargs.test_plenty("Hello", 1) != "Hello":
  17. raise RuntimeError, "Failed"
  18. if varargs.test_plenty("Hello", 1, 2) != "Hello":
  19. raise RuntimeError, "Failed"
  20. try:
  21. varargs.test_plenty("Hello", 1, 2, 3)
  22. raise RuntimeError
  23. except NotImplementedError:
  24. pass
  25. except TypeError:
  26. pass