Verify two linked traitlets can be unlinked and relinked.
(self)
| 2262 | self.assertEqual(a.value, 5) |
| 2263 | |
| 2264 | def test_unlink_link(self): |
| 2265 | """Verify two linked traitlets can be unlinked and relinked.""" |
| 2266 | |
| 2267 | # Create two simple classes with Int traitlets. |
| 2268 | class A(HasTraits): |
| 2269 | value = Int() |
| 2270 | |
| 2271 | a = A(value=9) |
| 2272 | b = A(value=8) |
| 2273 | |
| 2274 | # Connect the two classes. |
| 2275 | c = directional_link((a, "value"), (b, "value")) |
| 2276 | a.value = 4 |
| 2277 | c.unlink() |
| 2278 | |
| 2279 | # Change one of the values to make sure they don't stay in sync. |
| 2280 | a.value = 5 |
| 2281 | self.assertNotEqual(a.value, b.value) |
| 2282 | c.link() |
| 2283 | self.assertEqual(a.value, b.value) |
| 2284 | a.value += 1 |
| 2285 | self.assertEqual(a.value, b.value) |
| 2286 | |
| 2287 | |
| 2288 | class Pickleable(HasTraits): |
nothing calls this directly
no test coverage detected