Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_sort Namespace Reference

Classes

class  TestBase
class  TestBugs
class  TestDecorateSortUndecorate

Functions

def check
def test_main

Variables

 verbose = support.verbose
int nerrors = 0

Function Documentation

def test.test_sort.check (   tag,
  expected,
  raw,
  compare = None 
)

Definition at line 11 of file test_sort.py.

00011 
00012 def check(tag, expected, raw, compare=None):
00013     global nerrors
00014 
00015     if verbose:
00016         print("    checking", tag)
00017 
00018     orig = raw[:]   # save input in case of error
00019     if compare:
00020         raw.sort(key=cmp_to_key(compare))
00021     else:
00022         raw.sort()
00023 
00024     if len(expected) != len(raw):
00025         print("error in", tag)
00026         print("length mismatch;", len(expected), len(raw))
00027         print(expected)
00028         print(orig)
00029         print(raw)
00030         nerrors += 1
00031         return
00032 
00033     for i, good in enumerate(expected):
00034         maybe = raw[i]
00035         if good is not maybe:
00036             print("error in", tag)
00037             print("out of order at index", i, good, maybe)
00038             print(expected)
00039             print(orig)
00040             print(raw)
00041             nerrors += 1
00042             return

Here is the call graph for this function:

def test.test_sort.test_main (   verbose = None)

Definition at line 265 of file test_sort.py.

00265 
00266 def test_main(verbose=None):
00267     test_classes = (
00268         TestBase,
00269         TestDecorateSortUndecorate,
00270         TestBugs,
00271     )
00272 
00273     support.run_unittest(*test_classes)
00274 
00275     # verify reference counting
00276     if verbose and hasattr(sys, "gettotalrefcount"):
00277         import gc
00278         counts = [None] * 5
00279         for i in range(len(counts)):
00280             support.run_unittest(*test_classes)
00281             gc.collect()
00282             counts[i] = sys.gettotalrefcount()
00283         print(counts)


Variable Documentation

Definition at line 8 of file test_sort.py.

Definition at line 7 of file test_sort.py.