(self)
| 678 | |
| 679 | @support.cpython_only |
| 680 | def test_field_descriptor(self): |
| 681 | Point = namedtuple('Point', 'x y') |
| 682 | p = Point(11, 22) |
| 683 | self.assertTrue(inspect.isdatadescriptor(Point.x)) |
| 684 | self.assertEqual(Point.x.__get__(p), 11) |
| 685 | self.assertRaises(AttributeError, Point.x.__set__, p, 33) |
| 686 | self.assertRaises(AttributeError, Point.x.__delete__, p) |
| 687 | |
| 688 | for proto in range(pickle.HIGHEST_PROTOCOL + 1): |
| 689 | with self.subTest(proto=proto): |
| 690 | class NewPoint(tuple): |
| 691 | x = pickle.loads(pickle.dumps(Point.x, proto)) |
| 692 | y = pickle.loads(pickle.dumps(Point.y, proto)) |
| 693 | |
| 694 | np = NewPoint([1, 2]) |
| 695 | |
| 696 | self.assertEqual(np.x, 1) |
| 697 | self.assertEqual(np.y, 2) |
| 698 | |
| 699 | def test_new_builtins_issue_43102(self): |
| 700 | obj = namedtuple('C', ()) |
nothing calls this directly
no test coverage detected