MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_set_ops

Method test_set_ops

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

Source from the content-addressed store, hash-verified

321 in_(22, o)
322
323 def test_set_ops(self):
324 o1, o2 = util.OrderedSet([1, 3, 5, 7]), {2, 3, 4, 5}
325 eq_(o1 & o2, {3, 5})
326 eq_(o1.intersection(o2), {3, 5})
327 o3 = o1.copy()
328 o3 &= o2
329 eq_(o3, {3, 5})
330 o3 = o1.copy()
331 is_none(o3.intersection_update(o2))
332 eq_(o3, {3, 5})
333
334 eq_(o1 | o2, {1, 2, 3, 4, 5, 7})
335 eq_(o1.union(o2), {1, 2, 3, 4, 5, 7})
336 o3 = o1.copy()
337 o3 |= o2
338 eq_(o3, {1, 2, 3, 4, 5, 7})
339 o3 = o1.copy()
340 is_none(o3.update(o2))
341 eq_(o3, {1, 2, 3, 4, 5, 7})
342
343 eq_(o1 - o2, {1, 7})
344 eq_(o1.difference(o2), {1, 7})
345 o3 = o1.copy()
346 o3 -= o2
347 eq_(o3, {1, 7})
348 o3 = o1.copy()
349 is_none(o3.difference_update(o2))
350 eq_(o3, {1, 7})
351
352 eq_(o1 ^ o2, {1, 2, 4, 7})
353 eq_(o1.symmetric_difference(o2), {1, 2, 4, 7})
354 o3 = o1.copy()
355 o3 ^= o2
356 eq_(o3, {1, 2, 4, 7})
357 o3 = o1.copy()
358 is_none(o3.symmetric_difference_update(o2))
359 eq_(o3, {1, 2, 4, 7})
360
361 def test_copy(self):
362 o = util.OrderedSet([3, 2, 4, 5])

Callers

nothing calls this directly

Calls 11

eq_Function · 0.90
is_noneFunction · 0.90
intersectionMethod · 0.45
copyMethod · 0.45
intersection_updateMethod · 0.45
unionMethod · 0.45
updateMethod · 0.45
differenceMethod · 0.45
difference_updateMethod · 0.45
symmetric_differenceMethod · 0.45

Tested by

no test coverage detected