You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.6 KiB

  1. #!/usr/bin/env python
  2. from __future__ import print_function
  3. import sys, pydoc
  4. sys.path.append('.')
  5. import example
  6. from example import Example2
  7. Example2.value = 15
  8. print(Example2.value)
  9. print(Example2.value2)
  10. try:
  11. Example2()
  12. except Exception as e:
  13. print(e)
  14. try:
  15. Example2.value2 = 15
  16. except Exception as e:
  17. print(e)
  18. instance = Example2.new_instance()
  19. dict_result = instance.get_dict()
  20. dict_result['key2'] = 'value2'
  21. instance.print_dict(dict_result)
  22. dict_result = instance.get_dict_2()
  23. dict_result['key2'] = 'value2'
  24. instance.print_dict_2(dict_result)
  25. set_result = instance.get_set()
  26. set_result.add('key3')
  27. instance.print_set(set_result)
  28. set_result = instance.get_set2()
  29. set_result.add('key3')
  30. instance.print_set_2(set_result)
  31. list_result = instance.get_list()
  32. list_result.append('value2')
  33. instance.print_list(list_result)
  34. list_result = instance.get_list_2()
  35. list_result.append('value2')
  36. instance.print_list_2(list_result)
  37. array_result = instance.get_array()
  38. print(array_result)
  39. instance.print_array(array_result)
  40. try:
  41. instance.throw_exception()
  42. except Exception as e:
  43. print(e)
  44. print(instance.pair_passthrough((True, "test")))
  45. print(instance.tuple_passthrough((True, "test", 5)))
  46. print(pydoc.render_doc(Example2, "Help on %s"))
  47. print("__name__(example) = %s" % example.__name__)
  48. print("__name__(example.Example2) = %s" % Example2.__name__)
  49. print("__module__(example.Example2) = %s" % Example2.__module__)
  50. print("__name__(example.Example2.get_set) = %s" % Example2.get_set.__name__)
  51. print("__module__(example.Example2.get_set) = %s" % Example2.get_set.__module__)