There are so many of these, and all are very special purpose. There are
some modules in PyPI providing additional assert* methods, IIRC.
A common approach is to make a mixin class like this:
from os.path import isdir, isfile
def assertIsFolder(self, path, msg="not a folder"):
return self.assertTrue(isdir(path), msg)
def assertIsFile(self, path, msg="not a file"):
return self.assertTrue(isfile(path), msg)
and to define your test class like this:
class TestSomething(unittest.TestCase, PathTestsMixin):
and it will have those methods available. By putting the mixin in a
utility module you can then use it in many test files.
Cameron Simpson firstname.lastname@example.org