MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_set_comparisons

Method test_set_comparisons

test/ext/test_associationproxy.py:738–770  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

736 assert_raises(TypeError, set, [p1.children])
737
738 def test_set_comparisons(self):
739 Parent = self.classes.Parent
740
741 p1 = Parent("P1")
742 p1.children = ["a", "b", "c"]
743 control = {"a", "b", "c"}
744
745 for other in (
746 {"a", "b", "c"},
747 {"a", "b", "c", "d"},
748 {"a"},
749 {"a", "b"},
750 {"c", "d"},
751 {"e", "f", "g"},
752 set(),
753 ):
754 eq_(p1.children.union(other), control.union(other))
755 eq_(p1.children.difference(other), control.difference(other))
756 eq_((p1.children - other), (control - other))
757 eq_(p1.children.intersection(other), control.intersection(other))
758 eq_(
759 p1.children.symmetric_difference(other),
760 control.symmetric_difference(other),
761 )
762 eq_(p1.children.issubset(other), control.issubset(other))
763 eq_(p1.children.issuperset(other), control.issuperset(other))
764
765 self.assert_((p1.children == other) == (control == other))
766 self.assert_((p1.children != other) == (control != other))
767 self.assert_((p1.children < other) == (control < other))
768 self.assert_((p1.children <= other) == (control <= other))
769 self.assert_((p1.children > other) == (control > other))
770 self.assert_((p1.children >= other) == (control >= other))
771
772 def test_set_comparison_empty_to_empty(self):
773 # test issue #3265 which was fixed in Python version 2.7.8

Callers

nothing calls this directly

Calls 9

eq_Function · 0.90
ParentClass · 0.70
unionMethod · 0.45
differenceMethod · 0.45
intersectionMethod · 0.45
symmetric_differenceMethod · 0.45
issubsetMethod · 0.45
issupersetMethod · 0.45
assert_Method · 0.45

Tested by

no test coverage detected