"""
#'
-
+import abc
import sys, errno
import stat as st
raise TypeError("expected str, bytes or os.PathLike object, not "
+ path_type.__name__)
+
+class PathLike(abc.ABC):
+ """
+ Abstract base class for implementing the file system path protocol.
+ """
+ @abc.abstractmethod
+ def __fspath__(self):
+ """
+ Return the file system path representation of the object.
+ """
+ raise NotImplementedError
+
+ @classmethod
+ def __subclasshook__(cls, subclass):
+ return hasattr(subclass, '__fspath__')
return '#feelthegil'
self.assertEqual('#feelthegil', os.fspath(PathLike()))
+ self.assertTrue(issubclass(PathLike, os.PathLike))
+ self.assertTrue(isinstance(PathLike(), os.PathLike))
def test_garbage_in_exception_out(self):
vapor = type('blah', (), {})