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

Method test_basics

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

Source from the content-addressed store, hash-verified

275 self.assertNotEqual(Self, None)
276
277 def test_basics(self):
278 class Foo:
279 def bar(self) -> Self: ...
280 class FooStr:
281 def bar(self) -> 'Self': ...
282 class FooStrTyping:
283 def bar(self) -> 'typing.Self': ...
284
285 for target in [Foo, FooStr, FooStrTyping]:
286 with self.subTest(target=target):
287 self.assertEqual(gth(target.bar), {'return': Self})
288 self.assertIs(get_origin(Self), None)
289
290 def test_repr(self):
291 self.assertEqual(repr(Self), 'typing.Self')

Callers

nothing calls this directly

Calls 4

get_originFunction · 0.90
subTestMethod · 0.45
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected