(self)
| 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 | |
| 5412 | class DictProxyTests(unittest.TestCase): |
nothing calls this directly
no test coverage detected