def test_update_with_non_iterable(self): python_set = set() with self.assertRaises(TypeError) as python_exc: python_set.update(None) ts = TraitSet() with self.assertRaises(TypeError) as trait_exc: ts.update(None) self.assertEqual( str(trait_exc.exception), str(python_exc.exception), )
def test_update_with_nothing(self): notifier = mock.Mock() python_set = set() python_set.update() ts = TraitSet(notifiers=[notifier]) # when ts.update() # then notifier.assert_not_called() self.assertEqual(ts, python_set)
def test_update_varargs(self): ts = TraitSet(notifiers=[self.notification_handler]) ts.update({1, 2}, {3, 4}) self.assertEqual(self.added, {1, 2, 3, 4}) self.assertEqual(self.removed, set())