tests/test_source_chars.py
branchpy33
changeset 3794 398ea04239b5
parent 3721 0c93dd8ff567
child 3803 e2bd2e9f0b3e
--- a/tests/test_source_chars.py	Tue Nov 19 12:21:04 2013 +0000
+++ b/tests/test_source_chars.py	Tue Nov 19 13:50:34 2013 +0000
@@ -7,7 +7,7 @@
 setOutDir(__name__)
 from reportlab.lib.testutils import RL_HOME,testsFolder
 __version__=''' $Id$ '''
-import os, sys, glob, string, re
+import os, sys, glob, re
 from types import ModuleType, ClassType, MethodType, FunctionType
 import reportlab
 import unittest
@@ -26,7 +26,7 @@
 
     def checkFileForTabs(self, filename):
         txt = open_and_read(filename, 'r')
-        chunks = string.split(txt, '\t')
+        chunks = txt.split('\t')
         tabCount = len(chunks) - 1
         if tabCount:
             #raise Exception, "File %s contains %d tab characters!" % (filename, tabCount)
@@ -37,8 +37,8 @@
         initSize = len(txt)
         badLines = 0
         badChars = 0
-        for line in string.split(txt, '\n'):
-            stripped = string.rstrip(line)
+        for line in txt.split('\n'):
+            stripped = line.rstrip()
             spaces = len(line) - len(stripped)  # OK, so they might be trailing tabs, who cares?
             if spaces:
                 badLines = badLines + 1
@@ -68,15 +68,15 @@
         txt = open(filename, 'r').read()
         badChars = 0
         cleaned = []
-        for line in string.split(txt, '\n'):
-            stripped = string.rstrip(line)
+        for line in txt.split('\n'):
+            stripped = line.rstrip()
             cleaned.append(stripped)
             spaces = len(line) - len(stripped)  # OK, so they might be trailing tabs, who cares?
             if spaces:
                 badChars = badChars + spaces
 
         if badChars != 0:
-            open(filename, 'w').write(string.join(cleaned, '\n'))
+            open(filename, 'w').write('\n'.join(cleaned))
             print("file %s contained %d trailing spaces, FIXED" % (filename, badChars))
     print('done')