Wenzel Jakob | 5708221 | 2015-09-04 23:42:12 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | from __future__ import print_function |
Wenzel Jakob | 38bd711 | 2015-07-05 20:05:44 +0200 | [diff] [blame] | 3 | import sys, pydoc |
| 4 | sys.path.append('.') |
| 5 | |
| 6 | from example import Example2 |
| 7 | |
| 8 | Example2.value = 15 |
| 9 | print(Example2.value) |
| 10 | print(Example2.value2) |
| 11 | |
| 12 | try: |
| 13 | Example2() |
| 14 | except Exception as e: |
| 15 | print(e) |
| 16 | |
| 17 | try: |
| 18 | Example2.value2 = 15 |
| 19 | except Exception as e: |
| 20 | print(e) |
| 21 | |
| 22 | instance = Example2.new_instance() |
| 23 | |
| 24 | dict_result = instance.get_dict() |
| 25 | dict_result['key2'] = 'value2' |
| 26 | instance.print_dict(dict_result) |
| 27 | |
| 28 | dict_result = instance.get_dict_2() |
| 29 | dict_result['key2'] = 'value2' |
| 30 | instance.print_dict_2(dict_result) |
| 31 | |
Wenzel Jakob | 333e889 | 2015-11-14 19:04:49 +0100 | [diff] [blame^] | 32 | set_result = instance.get_set() |
| 33 | set_result.add(u'key3') |
| 34 | instance.print_set(set_result) |
| 35 | |
| 36 | set_result = instance.get_set2() |
| 37 | set_result.add(u'key3') |
| 38 | instance.print_set_2(set_result) |
| 39 | |
Wenzel Jakob | 38bd711 | 2015-07-05 20:05:44 +0200 | [diff] [blame] | 40 | list_result = instance.get_list() |
| 41 | list_result.append('value2') |
| 42 | instance.print_list(list_result) |
| 43 | |
| 44 | list_result = instance.get_list_2() |
| 45 | list_result.append('value2') |
| 46 | instance.print_list_2(list_result) |
| 47 | |
| 48 | try: |
| 49 | instance.throw_exception() |
| 50 | except Exception as e: |
| 51 | print(e) |
| 52 | |
| 53 | print(instance.pair_passthrough((True, "test"))) |
| 54 | print(instance.tuple_passthrough((True, "test", 5))) |
| 55 | |
| 56 | print(pydoc.render_doc(Example2, "Help on %s")) |