Show More
@@ -367,29 +367,29 b' class TestHasTraitsNotify(TestCase):' | |||
|
367 | 367 | |
|
368 | 368 | class A(HasTraits): |
|
369 | 369 | listen_to = ['a'] |
|
370 | ||
|
370 | ||
|
371 | 371 | a = Int(0) |
|
372 | 372 | b = 0 |
|
373 | ||
|
373 | ||
|
374 | 374 | def __init__(self, **kwargs): |
|
375 | 375 | super(A, self).__init__(**kwargs) |
|
376 | 376 | self.on_trait_change(self.listener1, ['a']) |
|
377 | ||
|
377 | ||
|
378 | 378 | def listener1(self, name, old, new): |
|
379 | 379 | self.b += 1 |
|
380 | 380 | |
|
381 | 381 | class B(A): |
|
382 | ||
|
382 | ||
|
383 | 383 | c = 0 |
|
384 | 384 | d = 0 |
|
385 | ||
|
385 | ||
|
386 | 386 | def __init__(self, **kwargs): |
|
387 | 387 | super(B, self).__init__(**kwargs) |
|
388 | 388 | self.on_trait_change(self.listener2) |
|
389 | ||
|
389 | ||
|
390 | 390 | def listener2(self, name, old, new): |
|
391 | 391 | self.c += 1 |
|
392 | ||
|
392 | ||
|
393 | 393 | def _a_changed(self, name, old, new): |
|
394 | 394 | self.d += 1 |
|
395 | 395 | |
@@ -455,7 +455,7 b' class TestHasTraits(TestCase):' | |||
|
455 | 455 | def __init__(self, i): |
|
456 | 456 | super(A, self).__init__() |
|
457 | 457 | self.i = i |
|
458 | ||
|
458 | ||
|
459 | 459 | a = A(5) |
|
460 | 460 | self.assertEqual(a.i, 5) |
|
461 | 461 | # should raise TypeError if no positional arg given |
@@ -888,7 +888,7 b' class TestList(TraitTestBase):' | |||
|
888 | 888 | _default_value = [] |
|
889 | 889 | _good_values = [[], [1], list(range(10)), (1,2)] |
|
890 | 890 | _bad_values = [10, [1,'a'], 'a'] |
|
891 | ||
|
891 | ||
|
892 | 892 | def coerce(self, value): |
|
893 | 893 | if value is not None: |
|
894 | 894 | value = list(value) |
@@ -1086,7 +1086,7 b' class TestLink(TestCase):' | |||
|
1086 | 1086 | count = Int() |
|
1087 | 1087 | a = A(value=9) |
|
1088 | 1088 | b = B(count=8) |
|
1089 | ||
|
1089 | ||
|
1090 | 1090 | # Register callbacks that count. |
|
1091 | 1091 | callback_count = [] |
|
1092 | 1092 | def a_callback(name, old, new): |
@@ -232,7 +232,7 b' class link(object):' | |||
|
232 | 232 | for obj,attr in self.objects.keys(): |
|
233 | 233 | if obj is not sending_obj or attr != sending_attr: |
|
234 | 234 | setattr(obj, attr, new) |
|
235 | ||
|
235 | ||
|
236 | 236 | def unlink(self): |
|
237 | 237 | for key, callback in self.objects.items(): |
|
238 | 238 | (obj,attr) = key |
@@ -1374,7 +1374,7 b' class List(Container):' | |||
|
1374 | 1374 | self.length_error(obj, value) |
|
1375 | 1375 | |
|
1376 | 1376 | return super(List, self).validate_elements(obj, value) |
|
1377 | ||
|
1377 | ||
|
1378 | 1378 | def validate(self, obj, value): |
|
1379 | 1379 | value = super(List, self).validate(obj, value) |
|
1380 | 1380 | if value is None: |
@@ -1383,7 +1383,7 b' class List(Container):' | |||
|
1383 | 1383 | value = self.validate_elements(obj, value) |
|
1384 | 1384 | |
|
1385 | 1385 | return value |
|
1386 | ||
|
1386 | ||
|
1387 | 1387 | |
|
1388 | 1388 | |
|
1389 | 1389 | class Set(List): |
General Comments 0
You need to be logged in to leave comments.
Login now