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

Method test_intersection

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

Source from the content-addressed store, hash-verified

1929 pass # TODO
1930
1931 def test_intersection(self):
1932 super_, sub_, twin1, twin2, unique1, unique2 = self._create_sets()
1933
1934 # basic set math
1935 eq_(sub_.intersection(super_), sub_)
1936 eq_(super_.intersection(sub_), sub_)
1937
1938 # the same sets
1939 eq_(twin1.intersection(twin2), twin1)
1940 eq_(twin2.intersection(twin1), twin1)
1941
1942 # empty sets
1943 empty = util.IdentitySet([])
1944 eq_(empty.intersection(empty), empty)
1945
1946 # totally different sets
1947 eq_(unique1.intersection(unique2), empty)
1948
1949 # not an IdentitySet
1950 not_an_identity_set = object()
1951 assert_raises(TypeError, unique1.intersection, not_an_identity_set)
1952
1953 def test_dunder_and(self):
1954 super_, sub_, twin1, twin2, unique1, unique2 = self._create_sets()

Callers

nothing calls this directly

Calls 4

_create_setsMethod · 0.95
intersectionMethod · 0.95
eq_Function · 0.90
assert_raisesFunction · 0.90

Tested by

no test coverage detected