mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
bpo-46483: change PurePath.__class_getitem__
to return GenericAlias
(GH-30822)
This commit is contained in:
parent
c7f20f1cc8
commit
1f715d5bd3
3 changed files with 13 additions and 5 deletions
|
@ -2429,13 +2429,19 @@ class _BasePathTest(object):
|
|||
def test_complex_symlinks_relative_dot_dot(self):
|
||||
self._check_complex_symlinks(os.path.join('dirA', '..'))
|
||||
|
||||
def test_class_getitem(self):
|
||||
from types import GenericAlias
|
||||
|
||||
alias = self.cls[str]
|
||||
self.assertIsInstance(alias, GenericAlias)
|
||||
self.assertIs(alias.__origin__, self.cls)
|
||||
self.assertEqual(alias.__args__, (str,))
|
||||
self.assertEqual(alias.__parameters__, ())
|
||||
|
||||
|
||||
class PathTest(_BasePathTest, unittest.TestCase):
|
||||
cls = pathlib.Path
|
||||
|
||||
def test_class_getitem(self):
|
||||
self.assertIs(self.cls[str], self.cls)
|
||||
|
||||
def test_concrete_class(self):
|
||||
p = self.cls('a')
|
||||
self.assertIs(type(p),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue