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

Method test_gh146587

Lib/test/test_descr.py:5386–5409  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5384 B().foo
5385
5386 def test_gh146587(self):
5387 # See https://github.com/python/cpython/issues/146587
5388
5389 class A:
5390 def __radd__(self, other): ...
5391
5392 class B(tuple): ...
5393
5394 self.assertIsNone(() + A())
5395 self.assertIsNone(B() + A())
5396
5397 from typing import NamedTuple
5398
5399 class T(NamedTuple):
5400 x: int
5401
5402 class A:
5403 def __init__(self, *args):
5404 self.lst = list(args)
5405 def __radd__(self, other):
5406 return A(*self.lst, other)
5407
5408 self.assertEqual(((1,)+A()).lst, [(1,)])
5409 self.assertEqual((T(x=1)+A()).lst, [T(x=1)])
5410
5411
5412class DictProxyTests(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

assertIsNoneMethod · 0.80
AClass · 0.70
BClass · 0.70
TClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected