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

Method test_dunder_or

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

Source from the content-addressed store, hash-verified

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()
1816
1817 # basic set math
1818 eq_(sub_ | super_, super_)
1819 eq_(super_ | sub_, super_)
1820
1821 # the same sets
1822 eq_(twin1 | twin2, twin1)
1823 eq_(twin2 | twin1, twin1)
1824
1825 # empty sets
1826 empty = util.IdentitySet([])
1827 eq_(empty | empty, empty)
1828
1829 # totally different sets
1830 unique1 = util.IdentitySet([1])
1831 unique2 = util.IdentitySet([2])
1832 eq_(unique1 | unique2, util.IdentitySet([1, 2]))
1833
1834 # not an IdentitySet
1835 def should_raise():
1836 not_an_identity_set = object()
1837 return unique1 | not_an_identity_set
1838
1839 assert_raises(TypeError, should_raise)
1840
1841 def test_update(self):
1842 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