diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index f793d10..0bad1e3 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -11,6 +11,12 @@ class PathclassException(Exception): class Exists(PathclassException): pass +class IsFile(PathclassException): + pass + +class IsDirectory(PathclassException): + pass + class IsLink(PathclassException): pass @@ -125,6 +131,14 @@ class Path: if self.exists: raise Exists(self) + def assert_not_file(self): + if self.is_file: + raise IsFile(self) + + def assert_not_directory(self): + if self.is_dir: + raise IsDirectory(self) + def assert_not_link(self): if self.is_link: raise IsLink(self)