def test_contains(self): """Testing Registry.__contains__""" r = Registry() r.register(1) self.assertTrue(1 in r) self.assertFalse(2 in r)
def test_registering_duplicate(self): """Testing Registry.register_item with duplicate items""" r = Registry() r.register(1) with self.assertRaises(AlreadyRegisteredError): r.register(1)
def test_register_item(self): """Testing Registry.register_item""" r = Registry() items = [1, 2, 3] for item in items: r.register(item) self.assertEqual(set(r), set(items))