def test_add_strings_and_contains(self): st = Sets() st.add("Hello") assert st.size == 1 st.add("Noah") assert st.size == 2 assert st.contains("Hello") == True assert st.contains("Noah") == True assert st.contains("Woodward") == False
def test_add_and_contains(self): st = Sets() st.add(5) assert st.size == 1 st.add(2) assert st.size == 2 assert st.contains(5) == True assert st.contains(2) == True assert st.contains(7) == False
def test_contains(self): set = Sets() set.add('A') set.add('B') # Assert True assert set.contains('A') == True assert set.contains('B') == True # Assert False assert set.contains('E') == False assert set.contains('F') == False
def test_add(self): s = Sets() s.add('A') assert s.set_struct.size == 1 assert s.contains('A') s.add('A') assert s.set_struct.size == 1 s.add('B') assert s.set_struct.size == 2 assert s.contains('B') s.add('B') assert s.set_struct.size == 2
def test_delete(self): st = Sets() st.add(1) st.add(3) st.add("hello") assert st.size == 3 st.delete(3) assert st.size == 2 assert st.contains(3) == False
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')
def test_contains(self): s = Sets(['A', 'B', 'C']) assert s.contains('A') == True assert s.contains('B') == True assert s.contains('C') == True assert s.contains('X') == False