tests/test_pyfiles.py
branchpy33
changeset 3794 398ea04239b5
parent 3721 0c93dd8ff567
child 3892 901db570cc14
equal deleted inserted replaced
3793:cc3f9cc828f7 3794:398ea04239b5
    72         for path in allPyFiles:
    72         for path in allPyFiles:
    73             fileContent = open_and_read(path,'r')
    73             fileContent = open_and_read(path,'r')
    74             nonAscii = [c for c in fileContent if ord(c)>127]
    74             nonAscii = [c for c in fileContent if ord(c)>127]
    75             nonAscii = unique(nonAscii)
    75             nonAscii = unique(nonAscii)
    76 
    76 
    77             truncPath = path[string.find(path, 'reportlab'):]
    77             truncPath = path[path.find('reportlab'):]
    78             args = (truncPath, repr(list(map(ord, nonAscii))))
    78             args = (truncPath, repr(list(map(ord, nonAscii))))
    79             msg = "File %s contains characters: %s." % args
    79             msg = "File %s contains characters: %s." % args
    80 ##            if nonAscii:
    80 ##            if nonAscii:
    81 ##                print msg
    81 ##                print msg
    82             assert nonAscii == '', msg
    82             assert nonAscii == '', msg
    91         from reportlab.lib.testutils import RL_HOME
    91         from reportlab.lib.testutils import RL_HOME
    92         allPyFiles = GlobDirectoryWalker(RL_HOME, '*.py')
    92         allPyFiles = GlobDirectoryWalker(RL_HOME, '*.py')
    93 
    93 
    94         for path in allPyFiles:
    94         for path in allPyFiles:
    95             #hack - exclude barcode extensions from this test
    95             #hack - exclude barcode extensions from this test
    96             if string.find(path, 'barcode'):
    96             if path.find('barcode'):
    97                 pass
    97                 pass
    98             else:
    98             else:
    99                 basename = os.path.splitext(path)[0]
    99                 basename = os.path.splitext(path)[0]
   100                 truncPath = path[string.find(path, 'reportlab'):]
   100                 truncPath = path[path.find('reportlab'):]
   101                 msg = "Filename %s contains trailing digits." % truncPath
   101                 msg = "Filename %s contains trailing digits." % truncPath
   102                 assert basename[-1] not in string.digits, msg
   102                 assert basename[-1] not in string.digits, msg
   103 
   103 
   104     ##            if basename[-1] in string.digits:
   104     ##            if basename[-1] in string.digits:
   105     ##                print truncPath
   105     ##                print truncPath