MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_dunder_or

Method test_dunder_or

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

Source from the content-addressed store, hash-verified

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()
1911
1912 # basic set math
1913 eq_(sub_ | super_, super_)
1914 eq_(super_ | sub_, super_)
1915
1916 # the same sets
1917 eq_(twin1 | twin2, twin1)
1918 eq_(twin2 | twin1, twin1)
1919
1920 # empty sets
1921 empty = util.IdentitySet([])
1922 eq_(empty | empty, empty)
1923
1924 # totally different sets
1925 unique1 = util.IdentitySet([1])
1926 unique2 = util.IdentitySet([2])
1927 eq_(unique1 | unique2, util.IdentitySet([1, 2]))
1928
1929 # not an IdentitySet
1930 def should_raise():
1931 not_an_identity_set = object()
1932 return unique1 | not_an_identity_set
1933
1934 assert_raises(TypeError, should_raise)
1935
1936 def test_update(self):
1937 pass # TODO

Callers

nothing calls this directly

Calls 3

_create_setsMethod · 0.95
eq_Function · 0.90
assert_raisesFunction · 0.90

Tested by

no test coverage detected