MCPcopy Index your code
hub / github.com/python/cpython / test_union

Method test_union

Lib/test/test_set.py:81–98  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

79 self.assertIn(self.thetype(self.letters), s)
80
81 def test_union(self):
82 u = self.s.union(self.otherword)
83 for c in self.letters:
84 self.assertEqual(c in u, c in self.d or c in self.otherword)
85 self.assertEqual(self.s, self.thetype(self.word))
86 self.assertEqual(type(u), self.basetype)
87 self.assertRaises(PassThru, self.s.union, check_pass_thru())
88 self.assertRaises(TypeError, self.s.union, [[]])
89 for C in set, frozenset, dict.fromkeys, str, list, tuple:
90 self.assertEqual(self.thetype('abcba').union(C('cdc')), set('abcd'))
91 self.assertEqual(self.thetype('abcba').union(C('efgfe')), set('abcefg'))
92 self.assertEqual(self.thetype('abcba').union(C('ccb')), set('abc'))
93 self.assertEqual(self.thetype('abcba').union(C('ef')), set('abcef'))
94 self.assertEqual(self.thetype('abcba').union(C('ef'), C('fg')), set('abcefg'))
95
96 # Issue #6573
97 x = self.thetype()
98 self.assertEqual(x.union(set([1]), x, set([2])), self.thetype([1, 2]))
99
100 def test_or(self):
101 i = self.s.union(self.otherword)

Callers

nothing calls this directly

Calls 6

check_pass_thruFunction · 0.85
setFunction · 0.85
unionMethod · 0.80
CClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected