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

Method test_truth

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

Source from the content-addressed store, hash-verified

314 self.assertEqual(operator.sub(5, 2), 3)
315
316 def test_truth(self):
317 operator = self.module
318 class C(object):
319 def __bool__(self):
320 raise SyntaxError
321 self.assertRaises(TypeError, operator.truth)
322 self.assertRaises(SyntaxError, operator.truth, C())
323 self.assertTrue(operator.truth(5))
324 self.assertTrue(operator.truth([0]))
325 self.assertFalse(operator.truth(0))
326 self.assertFalse(operator.truth([]))
327
328 def test_bitwise_xor(self):
329 operator = self.module

Callers

nothing calls this directly

Calls 4

assertTrueMethod · 0.80
assertFalseMethod · 0.80
CClass · 0.70
assertRaisesMethod · 0.45

Tested by

no test coverage detected