def test_remove(self): # Adding elements set = Sets() set.add('A') set.add('B') # Deleting elements set.remove('A') assert set.size == 1 set.remove('B') assert set.size == 0 with self.assertRaises(KeyError): set.remove('B')
def test_remove(self): s = Sets(['A', 'B', 'C']) assert s.set_struct.size == 3 assert s.contains('A') assert s.contains('B') assert s.contains('C') s.remove('A') assert s.set_struct.size == 2 assert s.contains('B') assert s.contains('C') s.remove('B') assert s.set_struct.size == 1 assert s.contains('C') with self.assertRaises(KeyError): s.remove('A')