Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
| File test_cases.diff,
1.2 KB
(added by xaka, 2 years ago) |
|
|
-
|
|
|
|
| 773 | 773 | assert w1.attrs == {'test':True} |
| 774 | 774 | assert w2.attrs == {} |
| 775 | 775 | |
| | 776 | def test_lazy_param_initialization(): |
| | 777 | touched = False |
| | 778 | class Widget(widgets.Widget): |
| | 779 | params = ['test'] |
| | 780 | def test(self): |
| | 781 | global touched |
| | 782 | touched = True |
| | 783 | w = Widget() |
| | 784 | assert not touched, 'Widget.test param must not be touched automatically!' |
| | 785 | |
| | 786 | def test_param_without_declaration(): |
| | 787 | class Widget(widgets.Widget): |
| | 788 | params = ['test'] |
| | 789 | w = Widget() |
| | 790 | assert w.test is None, 'w.test must be None' |
| | 791 | |
| | 792 | class Widget(widgets.Widget): |
| | 793 | params = ['test'] |
| | 794 | w = Widget(test=lambda:1) |
| | 795 | assert w.test == 1, '%s != %s' % (w.test, 1) |
| | 796 | |
| | 797 | class Widget(widgets.Widget): |
| | 798 | params = ['test'] |
| | 799 | w = Widget() |
| | 800 | w.test = lambda:1 |
| | 801 | assert w.test == 1, '%s != %s' % (w.test, 1) |
| | 802 | |
| 776 | 803 | def test_param_descriptor_properties(): |
| 777 | 804 | class Wid(widgets.Widget): |
| 778 | 805 | params = ['attrs'] |
Download in other formats: