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

Method test_intersection

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

Source from the content-addressed store, hash-verified

109 self.fail("s|t did not screen-out general iterables")
110
111 def test_intersection(self):
112 i = self.s.intersection(self.otherword)
113 for c in self.letters:
114 self.assertEqual(c in i, c in self.d and c in self.otherword)
115 self.assertEqual(self.s, self.thetype(self.word))
116 self.assertEqual(type(i), self.basetype)
117 self.assertRaises(PassThru, self.s.intersection, check_pass_thru())
118 for C in set, frozenset, dict.fromkeys, str, list, tuple:
119 self.assertEqual(self.thetype('abcba').intersection(C('cdc')), set('cc'))
120 self.assertEqual(self.thetype('abcba').intersection(C('efgfe')), set(''))
121 self.assertEqual(self.thetype('abcba').intersection(C('ccb')), set('bc'))
122 self.assertEqual(self.thetype('abcba').intersection(C('ef')), set(''))
123 self.assertEqual(self.thetype('abcba').intersection(C('cbcf'), C('bag')), set('b'))
124 s = self.thetype('abcba')
125 z = s.intersection()
126 if self.thetype == frozenset():
127 self.assertEqual(id(s), id(z))
128 else:
129 self.assertNotEqual(id(s), id(z))
130
131 def test_isdisjoint(self):
132 def f(s1, s2):

Callers

nothing calls this directly

Calls 8

check_pass_thruFunction · 0.85
setFunction · 0.85
idFunction · 0.85
assertNotEqualMethod · 0.80
CClass · 0.70
intersectionMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected