(self)
| 8345 | self.assertEqual(a, (1, [2])) |
| 8346 | |
| 8347 | def test_empty_namedtuple(self): |
| 8348 | with self.assertRaisesRegex(TypeError, "missing.*required.*argument"): |
| 8349 | BAD = NamedTuple('BAD') |
| 8350 | |
| 8351 | NT1 = NamedTuple('NT1', {}) |
| 8352 | NT2 = NamedTuple('NT2', ()) |
| 8353 | NT3 = NamedTuple('NT3', []) |
| 8354 | |
| 8355 | class CNT(NamedTuple): |
| 8356 | pass # empty body |
| 8357 | |
| 8358 | for struct in NT1, NT2, NT3, CNT: |
| 8359 | with self.subTest(struct=struct): |
| 8360 | self.assertEqual(struct._fields, ()) |
| 8361 | self.assertEqual(struct._field_defaults, {}) |
| 8362 | self.assertEqual(struct.__annotations__, {}) |
| 8363 | self.assertIsInstance(struct(), struct) |
| 8364 | |
| 8365 | def test_namedtuple_errors(self): |
| 8366 | with self.assertRaises(TypeError): |
nothing calls this directly
no test coverage detected