コード例 #1
0
 def test_clear_no_notifications_if_already_empty(self):
     # test no notifications are emitted if the set is already
     # empty.
     notifier = mock.Mock()
     ts = TraitSet(notifiers=[notifier])
     ts.clear()
     notifier.assert_not_called()
コード例 #2
0
    def test_clear(self):
        ts = TraitSet({1, 2, 3}, item_validator=int_validator,
                      notifiers=[self.notification_handler])
        ts.clear()

        self.assertEqual(self.removed, {1, 2, 3})
        self.assertEqual(self.added, set())