Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
Ticket #2447: fix_and_test_cases.diff
| File fix_and_test_cases.diff,
1.5 KB
(added by xaka, 2 years ago) |
|
|
-
|
|
|
|
| 477 | 477 | if not value.is_named: |
| 478 | 478 | value.name = name |
| 479 | 479 | declared_widgets.append(value) |
| 480 | | del class_dict[name] |
| 481 | 480 | declared_widgets.sort(key=lambda w: w._declaration_counter) |
| 482 | 481 | cls = type.__new__(meta, class_name, bases, class_dict) |
| 483 | 482 | cls.declared_widgets = declared_widgets |
-
|
|
|
|
| 239 | 239 | assert widgetlist[2] == w3 |
| 240 | 240 | assert widgetlist[3] == w4 |
| 241 | 241 | |
| | 242 | def test_declared_widgets_in_widgetslist_accessable(): |
| | 243 | class W1(widgets.WidgetsList): |
| | 244 | foo = widgets.Widget() |
| | 245 | w1 = W1() |
| | 246 | assert hasattr(w1, 'foo') |
| | 247 | |
| | 248 | class W2(W1): |
| | 249 | bar = widgets.Widget() |
| | 250 | w2 = W2() |
| | 251 | assert hasattr(w2, 'foo') |
| | 252 | assert hasattr(w2, 'bar') |
| | 253 | |
| | 254 | class W3(widgets.WidgetsList): |
| | 255 | pass |
| | 256 | w3 = W3(widgets.Widget(name='foo')) |
| | 257 | assert not hasattr(w3, 'foo'), 'Only declared widgets must be accessable by name' |
| | 258 | |
| 242 | 259 | def test_widget_url(): |
| 243 | 260 | """It might be needed to insert an URL somewhere""" |
| 244 | 261 | url = widgets.URLLink(link='http://www.turbogears.org') |
Download in other formats: