(self)
| 631 | self._notify2.append(change) |
| 632 | |
| 633 | def test_notify_all(self): |
| 634 | class A(HasTraits): |
| 635 | a = Int() |
| 636 | b = Float() |
| 637 | |
| 638 | a = A() |
| 639 | a.observe(self.notify1) |
| 640 | a.a = 0 |
| 641 | self.assertEqual(len(self._notify1), 0) |
| 642 | a.b = 0.0 |
| 643 | self.assertEqual(len(self._notify1), 0) |
| 644 | a.a = 10 |
| 645 | change = change_dict("a", 0, 10, a, "change") |
| 646 | self.assertTrue(change in self._notify1) |
| 647 | a.b = 10.0 |
| 648 | change = change_dict("b", 0.0, 10.0, a, "change") |
| 649 | self.assertTrue(change in self._notify1) |
| 650 | self.assertRaises(TraitError, setattr, a, "a", "bad string") |
| 651 | self.assertRaises(TraitError, setattr, a, "b", "bad string") |
| 652 | self._notify1 = [] |
| 653 | a.unobserve(self.notify1) |
| 654 | a.a = 20 |
| 655 | a.b = 20.0 |
| 656 | self.assertEqual(len(self._notify1), 0) |
| 657 | |
| 658 | def test_notify_one(self): |
| 659 | class A(HasTraits): |
nothing calls this directly
no test coverage detected