MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_non_generic_subscript

Method test_non_generic_subscript

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

Source from the content-addressed store, hash-verified

8250 self.assertEqual(X[str].__parameters__, ())
8251
8252 def test_non_generic_subscript(self):
8253 # For backward compatibility, subscription works
8254 # on arbitrary NamedTuple types.
8255 class Group(NamedTuple):
8256 key: T
8257 group: list[T]
8258 A = Group[int]
8259 self.assertEqual(A.__origin__, Group)
8260 self.assertEqual(A.__parameters__, ())
8261 self.assertEqual(A.__args__, (int,))
8262 a = A(1, [2])
8263 self.assertIs(type(a), Group)
8264 self.assertEqual(a, (1, [2]))
8265
8266 def test_namedtuple_keyword_usage(self):
8267 with self.assertWarnsRegex(

Callers

nothing calls this directly

Calls 3

AClass · 0.70
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected