MCPcopy Index your code
hub / github.com/bleachbit/bleachbit / assertExists

Method assertExists

tests/common.py:179–188  ·  view source on GitHub ↗

File, directory, or any path exists

(self, path, msg='', func=os.stat)

Source from the content-addressed store, hash-verified

177 # file asserts
178 #
179 def assertExists(self, path, msg='', func=os.stat):
180 """File, directory, or any path exists"""
181 if isinstance(path, Path):
182 path = str(path)
183 assert isinstance(
184 path, str), f'path must be a string, not {type(path)}'
185 path = os.path.expandvars(path)
186 if not self.check_exists(func, getTestPath(path)):
187 raise AssertionError(
188 'The file %s should exist, but it does not. %s' % (path, msg))
189
190 def assertNotExists(self, path, msg='', func=os.stat):
191 if self.check_exists(func, getTestPath(path)):

Callers 15

assertLExistsMethod · 0.95
assertCondExistsMethod · 0.95
mkdirMethod · 0.95
test_expanduserMethod · 0.80
test_get_share_pathMethod · 0.80
_test_encodingMethod · 0.80
_test_deleteMethod · 0.80
test_make_sourceMethod · 0.80
_context_helperMethod · 0.80

Calls 2

check_existsMethod · 0.95
getTestPathFunction · 0.85