| 507 | self.assertTrue(("b", 0.0, 10.0) in self._notify2) |
| 508 | |
| 509 | def test_static_notify(self): |
| 510 | class A(HasTraits): |
| 511 | a = Int() |
| 512 | _notify1 = [] |
| 513 | |
| 514 | def _a_changed(self, name, old, new): |
| 515 | self._notify1.append((name, old, new)) |
| 516 | |
| 517 | a = A() |
| 518 | a.a = 0 |
| 519 | # This is broken!!! |
| 520 | self.assertEqual(len(a._notify1), 0) |
| 521 | a.a = 10 |
| 522 | self.assertTrue(("a", 0, 10) in a._notify1) |
| 523 | |
| 524 | class B(A): |
| 525 | b = Float() |
| 526 | _notify2 = [] |
| 527 | |
| 528 | def _b_changed(self, name, old, new): |
| 529 | self._notify2.append((name, old, new)) |
| 530 | |
| 531 | b = B() |
| 532 | b.a = 10 |
| 533 | b.b = 10.0 |
| 534 | self.assertTrue(("a", 0, 10) in b._notify1) |
| 535 | self.assertTrue(("b", 0.0, 10.0) in b._notify2) |
| 536 | |
| 537 | def test_notify_args(self): |
| 538 | def callback0(): |