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

Method test_union

test/base/test_utils.py:1790–1812  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1788 assert_raises(TypeError, unique1.issuperset, not_an_identity_set)
1789
1790 def test_union(self):
1791 super_, sub_, twin1, twin2, _, _ = self._create_sets()
1792
1793 # basic set math
1794 eq_(sub_.union(super_), super_)
1795 eq_(super_.union(sub_), super_)
1796
1797 # the same sets
1798 eq_(twin1.union(twin2), twin1)
1799 eq_(twin2.union(twin1), twin1)
1800
1801 # empty sets
1802 empty = util.IdentitySet([])
1803 eq_(empty.union(empty), empty)
1804
1805 # totally different sets
1806 unique1 = util.IdentitySet([1])
1807 unique2 = util.IdentitySet([2])
1808 eq_(unique1.union(unique2), util.IdentitySet([1, 2]))
1809
1810 # not an IdentitySet
1811 not_an_identity_set = object()
1812 assert_raises(TypeError, unique1.union, not_an_identity_set)
1813
1814 def test_dunder_or(self):
1815 super_, sub_, twin1, twin2, _, _ = self._create_sets()

Callers

nothing calls this directly

Calls 4

_create_setsMethod · 0.95
unionMethod · 0.95
eq_Function · 0.90
assert_raisesFunction · 0.90

Tested by

no test coverage detected