MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / validate_result

Function validate_result

tests/common.py:344–369  ·  view source on GitHub ↗

Validate the command returned valid results

(self, result, really_delete=False)

Source from the content-addressed store, hash-verified

342
343
344def validate_result(self, result, really_delete=False):
345 """Validate the command returned valid results"""
346 self.assertIsInstance(result, dict, "result is a %s" % type(result))
347 # label
348 self.assertIsString(result['label'])
349 self.assertGreater(len(result['label'].strip()), 0)
350 # n_*
351 self.assertIsInteger(result['n_deleted'])
352 self.assertGreaterEqual(result['n_deleted'], 0)
353 self.assertLessEqual(result['n_deleted'], 1)
354 self.assertEqual(result['n_special'] + result['n_deleted'], 1)
355 # size
356 self.assertIsInstance(result['size'], (int, type(
357 None),), "size is %s" % str(result['size']))
358 # path
359 filename = result['path']
360 if not filename:
361 # the process action, for example, does not have a filename
362 return
363 self.assertIsInstance(filename, (str, type(None)),
364 "Filename is invalid: '%s' (type %s)" % (filename, type(filename)))
365 if isinstance(filename, str) and not filename[0:2] == 'HK':
366 if really_delete:
367 self.assertNotLExists(filename)
368 else:
369 self.assertLExists(filename)
370
371
372def get_winregistry_value(key, subkey):

Callers

nothing calls this directly

Calls 4

assertIsStringMethod · 0.80
assertIsIntegerMethod · 0.80
assertNotLExistsMethod · 0.80
assertLExistsMethod · 0.80

Tested by

no test coverage detected