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

Method test_comp_classes_different

Lib/test/test_compare.py:367–383  ·  view source on GitHub ↗

Compare different-class instances with comparison methods.

(self)

Source from the content-addressed store, hash-verified

365 cls.meth, cls.meth)
366
367 def test_comp_classes_different(self):
368 """Compare different-class instances with comparison methods."""
369
370 for cls_a in self.all_comp_classes:
371 for cls_b in self.all_comp_classes:
372 with self.subTest(a=cls_a, b=cls_b):
373 a1 = cls_a()
374 a1.x = 1
375 b1 = cls_b()
376 b1.x = 1
377 b2 = cls_b()
378 b2.x = 2
379
380 self.assert_total_order(
381 a1, b1, 0, cls_a.meth, cls_b.meth)
382 self.assert_total_order(
383 a1, b2, -1, cls_a.meth, cls_b.meth)
384
385 def test_str_subclass(self):
386 """Compare instances of str and a subclass."""

Callers

nothing calls this directly

Calls 2

assert_total_orderMethod · 0.95
subTestMethod · 0.45

Tested by

no test coverage detected