def test_intersect(self): s1 = EquivSet() s2 = EquivSet() r = s1.intersect(s2) self.assertTrue(r.is_empty()) s1.insert_equiv('a', 'b') r = s1.intersect(s2) self.assertTrue(r.is_empty()) s2.insert_equiv('b', 'c') r = s1.intersect(s2) self.assertTrue(r.is_empty()) s2.insert_equiv('d', 'a') r = s1.intersect(s2) self.assertTrue(r.is_empty()) s1.insert_equiv('a', 'e') s2.insert_equiv('c', 'd') r = s1.intersect(s2) self.assertTrue(r.is_equiv('a', 'b')) self.assertFalse(r.is_equiv('a', 'e')) self.assertFalse(r.is_equiv('c', 'd'))
def test_intersect(self): s1 = EquivSet() s2 = EquivSet() r = s1.intersect(s2) self.assertTrue(r.is_empty()) s1.insert_equiv("a", "b") r = s1.intersect(s2) self.assertTrue(r.is_empty()) s2.insert_equiv("b", "c") r = s1.intersect(s2) self.assertTrue(r.is_empty()) s2.insert_equiv("d", "a") r = s1.intersect(s2) self.assertTrue(r.is_empty()) s1.insert_equiv("a", "e") s2.insert_equiv("c", "d") r = s1.intersect(s2) self.assertTrue(r.is_equiv("a", "b")) self.assertFalse(r.is_equiv("a", "e")) self.assertFalse(r.is_equiv("c", "d"))