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

Method test_non_generic_subscript

Lib/test/test_typing.py:8333–8345  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8331 self.assertEqual(X[str].__parameters__, ())
8332
8333 def test_non_generic_subscript(self):
8334 # For backward compatibility, subscription works
8335 # on arbitrary NamedTuple types.
8336 class Group(NamedTuple):
8337 key: T
8338 group: list[T]
8339 A = Group[int]
8340 self.assertEqual(A.__origin__, Group)
8341 self.assertEqual(A.__parameters__, ())
8342 self.assertEqual(A.__args__, (int,))
8343 a = A(1, [2])
8344 self.assertIs(type(a), Group)
8345 self.assertEqual(a, (1, [2]))
8346
8347 def test_empty_namedtuple(self):
8348 with self.assertRaisesRegex(TypeError, "missing.*required.*argument"):

Callers

nothing calls this directly

Calls 3

AClass · 0.70
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected