def test_eq(self): self.assertEqual(get_all_mechs(), get_all_mechs()) new_set1 = MutableOIDSet() new_set2 = MutableOIDSet() counter = 0 for mech in get_all_mechs(): new_set1.add(mech) self.assertEqual(new_set1, new_set1) counter += 1 if counter < len(get_all_mechs()): self.assertNotEqual(new_set1, get_all_mechs()) self.assertEqual(new_set1, get_all_mechs()) counter = 0 for mech in new_set1: new_set2.add(mech) self.assertEqual(new_set2, new_set2) counter += 1 if counter < len(new_set1): self.assertNotEqual(new_set1, new_set2) self.assertEqual(new_set2, new_set1) self.assertEqual(new_set2, get_all_mechs())
def test_add(self): new_set = MutableOIDSet() prev_len = 0 for mech in get_all_mechs(): new_set.add(mech) self.assertEqual(len(new_set), prev_len + 1) prev_len += 1 self.assertEqual(len(new_set), len(get_all_mechs())) for mech in get_all_mechs(): self.assertIn(mech, new_set) self.assertRaises(TypeError, new_set.add, ('not a mech', ))