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

Method test_ne_high_priority

Lib/test/test_compare.py:54–70  ·  view source on GitHub ↗

object.__ne__() should allow reflected __ne__() to be tried

(self)

Source from the content-addressed store, hash-verified

52 self.assertIs(a != c, True)
53
54 def test_ne_high_priority(self):
55 """object.__ne__() should allow reflected __ne__() to be tried"""
56 calls = []
57 class Left:
58 # Inherits object.__ne__()
59 def __eq__(*args):
60 calls.append('Left.__eq__')
61 return NotImplemented
62 class Right:
63 def __eq__(*args):
64 calls.append('Right.__eq__')
65 return NotImplemented
66 def __ne__(*args):
67 calls.append('Right.__ne__')
68 return NotImplemented
69 Left() != Right()
70 self.assertSequenceEqual(calls, ['Left.__eq__', 'Right.__ne__'])
71
72 def test_ne_low_priority(self):
73 """object.__ne__() should not invoke reflected __eq__()"""

Callers

nothing calls this directly

Calls 3

assertSequenceEqualMethod · 0.80
LeftClass · 0.70
RightClass · 0.70

Tested by

no test coverage detected