fix FilePath and DirectoryPath (#226)

This commit is contained in:
Samuel Colvin
2018-07-07 16:58:58 +01:00
committed by GitHub
parent 489a1d32b1
commit 03517e4e07
+2
View File
@@ -329,6 +329,7 @@ class FilePath(Path):
yield path_exists_validator
yield cls.validate
@classmethod
def validate(cls, value: Path) -> Path:
if not value.is_file():
raise errors.PathNotAFileError(path=value)
@@ -343,6 +344,7 @@ class DirectoryPath(Path):
yield path_exists_validator
yield cls.validate
@classmethod
def validate(cls, value: Path) -> Path:
if not value.is_dir():
raise errors.PathNotADirectoryError(path=value)