Add assert_not_file, assert_not_directory to round it out.
This commit is contained in:
parent
44d9bd9913
commit
ebe009f2a2
1 changed files with 14 additions and 0 deletions
|
@ -11,6 +11,12 @@ class PathclassException(Exception):
|
||||||
class Exists(PathclassException):
|
class Exists(PathclassException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class IsFile(PathclassException):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class IsDirectory(PathclassException):
|
||||||
|
pass
|
||||||
|
|
||||||
class IsLink(PathclassException):
|
class IsLink(PathclassException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -125,6 +131,14 @@ class Path:
|
||||||
if self.exists:
|
if self.exists:
|
||||||
raise Exists(self)
|
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):
|
def assert_not_link(self):
|
||||||
if self.is_link:
|
if self.is_link:
|
||||||
raise IsLink(self)
|
raise IsLink(self)
|
||||||
|
|
Loading…
Reference in a new issue