(self)
| 437 | self._notify2.append((name, old, new)) |
| 438 | |
| 439 | def test_notify_all(self): |
| 440 | class A(HasTraits): |
| 441 | a = Int() |
| 442 | b = Float() |
| 443 | |
| 444 | a = A() |
| 445 | a.on_trait_change(self.notify1) |
| 446 | a.a = 0 |
| 447 | self.assertEqual(len(self._notify1), 0) |
| 448 | a.b = 0.0 |
| 449 | self.assertEqual(len(self._notify1), 0) |
| 450 | a.a = 10 |
| 451 | self.assertTrue(("a", 0, 10) in self._notify1) |
| 452 | a.b = 10.0 |
| 453 | self.assertTrue(("b", 0.0, 10.0) in self._notify1) |
| 454 | self.assertRaises(TraitError, setattr, a, "a", "bad string") |
| 455 | self.assertRaises(TraitError, setattr, a, "b", "bad string") |
| 456 | self._notify1 = [] |
| 457 | a.on_trait_change(self.notify1, remove=True) |
| 458 | a.a = 20 |
| 459 | a.b = 20.0 |
| 460 | self.assertEqual(len(self._notify1), 0) |
| 461 | |
| 462 | def test_notify_one(self): |
| 463 | class A(HasTraits): |
nothing calls this directly
no test coverage detected