MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_countOf

Method test_countOf

Lib/test/test_operator.py:164–175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

162 self.assertRaises(TypeError, operator.concat, 13, 29)
163
164 def test_countOf(self):
165 operator = self.module
166 self.assertRaises(TypeError, operator.countOf)
167 self.assertRaises(TypeError, operator.countOf, None, None)
168 self.assertRaises(ZeroDivisionError, operator.countOf, BadIterable(), 1)
169 self.assertEqual(operator.countOf([1, 2, 1, 3, 1, 4], 3), 1)
170 self.assertEqual(operator.countOf([1, 2, 1, 3, 1, 4], 5), 0)
171 # is but not ==
172 nan = float("nan")
173 self.assertEqual(operator.countOf([nan, nan, 21], nan), 2)
174 # == but not is
175 self.assertEqual(operator.countOf([{}, 1, {}, 2], {}), 2)
176
177 def test_delitem(self):
178 operator = self.module

Callers

nothing calls this directly

Calls 3

BadIterableClass · 0.70
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected