Back to index

python3.2  3.2.2
Classes | Functions
test.test_ntpath Namespace Reference

Classes

class  TestNtpath
class  NtCommonTest

Functions

def tester
def test_main

Function Documentation

Definition at line 262 of file test_ntpath.py.

00262 
00263 def test_main():
00264     support.run_unittest(TestNtpath, NtCommonTest)
00265 

def test.test_ntpath.tester (   fn,
  wantResult 
)

Definition at line 10 of file test_ntpath.py.

00010 
00011 def tester(fn, wantResult):
00012     fn = fn.replace("\\", "\\\\")
00013     gotResult = eval(fn)
00014     if wantResult != gotResult:
00015         raise TestFailed("%s should return: %s but returned: %s" \
00016               %(str(fn), str(wantResult), str(gotResult)))
00017 
00018     # then with bytes
00019     fn = fn.replace("('", "(b'")
00020     fn = fn.replace('("', '(b"')
00021     fn = fn.replace("['", "[b'")
00022     fn = fn.replace('["', '[b"')
00023     fn = fn.replace(", '", ", b'")
00024     fn = fn.replace(', "', ', b"')
00025     gotResult = eval(fn)
00026     if isinstance(wantResult, str):
00027         wantResult = wantResult.encode('ascii')
00028     elif isinstance(wantResult, tuple):
00029         wantResult = tuple(r.encode('ascii') for r in wantResult)
00030 
00031     gotResult = eval(fn)
00032     if wantResult != gotResult:
00033         raise TestFailed("%s should return: %s but returned: %s" \
00034               %(str(fn), str(wantResult), repr(gotResult)))
00035 

Here is the caller graph for this function: