MCPcopy
hub / github.com/cool-RR/PySnooper / verify_normalize

Function verify_normalize

tests/utils.py:344–359  ·  view source on GitHub ↗
(lines, prefix)

Source from the content-addressed store, hash-verified

342
343
344def verify_normalize(lines, prefix):
345 time_re = re.compile(r"[0-9:.]{15}")
346 src_re = re.compile(r'^(?: *)Source path:\.\.\. (.*)$')
347 for line in lines:
348 if DEFAULT_REPR_RE.search(line):
349 msg = "normalize is active, memory address should not appear"
350 raise OutputFailure(line, msg)
351 no_prefix = line.replace(prefix if prefix else '', '').strip()
352 if time_re.match(no_prefix):
353 msg = "normalize is active, time should not appear"
354 raise OutputFailure(line, msg)
355 m = src_re.match(line)
356 if m:
357 if not os.path.basename(m.group(1)) == m.group(1):
358 msg = "normalize is active, path should be only basename"
359 raise OutputFailure(line, msg)
360
361
362def assert_output(output, expected_entries, prefix=None, normalize=False):

Callers 1

assert_outputFunction · 0.85

Calls 4

OutputFailureClass · 0.85
replaceMethod · 0.80
matchMethod · 0.80
groupMethod · 0.45

Tested by

no test coverage detected