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

Method test_safe_object_compare

Lib/test/test_sort.py:313–327  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

311
312class TestOptimizedCompares(unittest.TestCase):
313 def test_safe_object_compare(self):
314 heterogeneous_lists = [[0, 'foo'],
315 [0.0, 'foo'],
316 [('foo',), 'foo']]
317 for L in heterogeneous_lists:
318 self.assertRaises(TypeError, L.sort)
319 self.assertRaises(TypeError, [(x,) for x in L].sort)
320 self.assertRaises(TypeError, [((x,),) for x in L].sort)
321
322 float_int_lists = [[1,1.1],
323 [1<<70,1.1],
324 [1.1,1],
325 [1.1,1<<70]]
326 for L in float_int_lists:
327 check_against_PyObject_RichCompareBool(self, L)
328
329 def test_unsafe_object_compare(self):
330

Callers

nothing calls this directly

Calls 2

assertRaisesMethod · 0.45

Tested by

no test coverage detected