MCPcopy Index your code
hub / github.com/python/cpython / check

Function check

Lib/test/test_sort.py:10–40  ·  view source on GitHub ↗
(tag, expected, raw, compare=None)

Source from the content-addressed store, hash-verified

8
9
10def check(tag, expected, raw, compare=None):
11 global nerrors
12
13 if verbose:
14 print(" checking", tag)
15
16 orig = raw[:] # save input in case of error
17 if compare:
18 raw.sort(key=cmp_to_key(compare))
19 else:
20 raw.sort()
21
22 if len(expected) != len(raw):
23 print("error in", tag)
24 print("length mismatch;", len(expected), len(raw))
25 print(expected)
26 print(orig)
27 print(raw)
28 nerrors += 1
29 return
30
31 for i, good in enumerate(expected):
32 maybe = raw[i]
33 if good is not maybe:
34 print("error in", tag)
35 print("out of order at index", i, good, maybe)
36 print(expected)
37 print(orig)
38 print(raw)
39 nerrors += 1
40 return
41
42class TestBase(unittest.TestCase):
43 def testStressfully(self):

Callers 15

test_fnmatchMethod · 0.70
test_slow_fnmatchMethod · 0.70
test_fnmatchcaseMethod · 0.70
test_caseMethod · 0.70
test_sepMethod · 0.70
test_char_setMethod · 0.70
test_rangeMethod · 0.70
test_sep_in_char_setMethod · 0.70
test_sep_in_rangeMethod · 0.70
test_warningsMethod · 0.70
test_errorsMethod · 0.70

Calls 3

cmp_to_keyFunction · 0.90
enumerateFunction · 0.85
sortMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…