def __subclasshook__(cls, subclass):
return hasattr(subclass, '__fspath__')
+ def __class_getitem__(cls, type):
+ return cls
+
if name == 'nt':
class _AddedDllDirectory:
return NotImplemented
return self._cparts >= other._cparts
+ def __class_getitem__(cls, type):
+ return cls
+
drive = property(attrgetter('_drv'),
doc="""The drive prefix (letter or UNC path), if any.""")
self.assertRaises(ZeroDivisionError, self.fspath,
FakePath(ZeroDivisionError()))
+ def test_pathlike_class_getitem(self):
+ self.assertIs(os.PathLike[bytes], os.PathLike)
+
class TimesTests(unittest.TestCase):
def test_times(self):
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),
--- /dev/null
+Implement ``__class_getitem__`` for ``os.PathLike``, ``pathlib.Path``