Source

SCons / test / textfile.py

Diff from to

test/textfile.py

 import TestSCons
 
 import os
-import string
 
 test = TestSCons.TestSCons()
 
 env.Textfile('foo2a.txt', data + [''], LINESEPARATOR='|*')
 
 # recreate the list with the data wrapped in Value()
-data0 = map(Value, data0)
-data = map(Value, data)
+data0 = list(map(Value, data0))
+data = list(map(Value, data))
 data[2] = data0
 
 env.Substfile('bar1', data)
 textparts = ['lalala', '42',
              'Goethe', 'Schiller',
              'tanteratei']
-foo1Text  = string.join(textparts, os.linesep)
-foo2Text  = string.join(textparts, '|*')
+foo1Text  = os.linesep.join(textparts)
+foo2Text  = '|*'.join(textparts)
 foo1aText = foo1Text + os.linesep
 foo2aText = foo2Text + '|*'
 
 test.up_to_date(arguments = '.')
 
-files = map(test.workpath, (
+files = list(map(test.workpath, (
             'foo1.txt', 'foo2.txt', 'foo1a.txt', 'foo2a.txt',
             'bar1',     'bar2',     'bar1a.txt', 'bar2a.txt',
-        ))
+        )))
 def check_times():
     # make sure the files didn't get rewritten, because nothing changed:
-    before = map(os.path.getmtime, files)
+    before = list(map(os.path.getmtime, files))
     # introduce a small delay, to make the test valid
     test.sleep()
     # should still be up-to-date
     test.up_to_date(arguments = '.')
-    after = map(os.path.getmtime, files)
+    after = list(map(os.path.getmtime, files))
     test.fail_test(before != after)
 
 # make sure that the file content is as expected
 line3b = 'This line has many substitutions'
 
 def matchem(file, lines):
-    lines = string.join(lines, os.linesep)
+    lines = os.linesep.join(lines)
     test.must_match(file, lines)
 
 matchem('text.txt', [line1, line2a, line3a])