def test_intersection(c, d, ans): from sets.verified_sets import IntSet a = IntSet(c) b = IntSet(d) t = a.intersection(b) assert (str(t) == ans and isinstance(t, IntSet)), \ f"Expected intersection {ans} and type IntSet"
def test_symmetric_difference(c, d, ans): from sets.verified_sets import IntSet a = IntSet(c) b = IntSet(d) t = a.symmetric_difference(b) assert (str(t) == ans and isinstance(t, IntSet)), \ f"Expected symmetric difference {ans} and type IntSet"
def test_union(c, d, ans): from sets.verified_sets import IntSet a = IntSet(c) b = IntSet(d) t = a.union(b) assert str(t) == ans and isinstance( t, IntSet ), f"Expected union {ans} and type IntSet"
def test_difference(c, d, ans): from sets.verified_sets import IntSet a = IntSet(c) b = IntSet(d) t = a.difference(b) assert str(t) == ans and isinstance( t, IntSet ), f"Expected difference {ans} and type IntSet"
def test_copy(): from sets.verified_sets import IntSet a = IntSet((9, 1, 10)) b = a.copy() assert (str(b) == str(a) and isinstance(b, IntSet))
def test_difference_subclass(): from sets.verified_sets import IntSet a = IntSet(()) with pytest.raises(TypeError): a.difference(("a", "b"))
def test_intersection_subclass(): from sets.verified_sets import IntSet a = IntSet(()) with pytest.raises(TypeError): a.intersection(("a", "b"))
def test_symmetric_difference_subclass(): a = IntSet(()) with pytest.raises(TypeError): a.symmetric_difference_update((1, "s"))
def test_symmetric_difference_update(c, d, ans): a = IntSet(c) b = IntSet(d) a.symmetric_difference_update(b) assert (str(a) == ans and isinstance(a, IntSet)), \ f"Expected set of {ans} but got {a}"
def test_update_subclass(): a = IntSet(()) with pytest.raises(TypeError): a.update((1, "s"))
def test_add_subclass(): a = IntSet(()) with pytest.raises(TypeError): a.add("s")
def test_add(s, a, ans): c = IntSet(s) c.add(a) assert (str(c) == ans and isinstance(c, IntSet)), \ f"Expected set of {ans} but got {c}"