MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_union

Method test_union

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

Source from the content-addressed store, hash-verified

1883 assert_raises(TypeError, unique1.issuperset, not_an_identity_set)
1884
1885 def test_union(self):
1886 super_, sub_, twin1, twin2, _, _ = self._create_sets()
1887
1888 # basic set math
1889 eq_(sub_.union(super_), super_)
1890 eq_(super_.union(sub_), super_)
1891
1892 # the same sets
1893 eq_(twin1.union(twin2), twin1)
1894 eq_(twin2.union(twin1), twin1)
1895
1896 # empty sets
1897 empty = util.IdentitySet([])
1898 eq_(empty.union(empty), empty)
1899
1900 # totally different sets
1901 unique1 = util.IdentitySet([1])
1902 unique2 = util.IdentitySet([2])
1903 eq_(unique1.union(unique2), util.IdentitySet([1, 2]))
1904
1905 # not an IdentitySet
1906 not_an_identity_set = object()
1907 assert_raises(TypeError, unique1.union, not_an_identity_set)
1908
1909 def test_dunder_or(self):
1910 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