[Python-checkins] r58084 - python/trunk/Lib/test/test_pipes.py

martin.v.loewis python-checkins at python.org
Mon Sep 10 08:18:32 CEST 2007


Author: martin.v.loewis
Date: Mon Sep 10 08:18:32 2007
New Revision: 58084

Modified:
   python/trunk/Lib/test/test_pipes.py
Log:
tr a-z A-Z does not work on Solaris (would require
/usr/xpg4/bin/tr); make the character ranges explicit.


Modified: python/trunk/Lib/test/test_pipes.py
==============================================================================
--- python/trunk/Lib/test/test_pipes.py	(original)
+++ python/trunk/Lib/test/test_pipes.py	Mon Sep 10 08:18:32 2007
@@ -9,6 +9,9 @@
 
 TESTFN2 = TESTFN + "2"
 
+# tr a-z A-Z is not portable, so make the ranges explicit
+s_command = 'tr %s %s' % (string.ascii_lowercase, string.ascii_uppercase)
+
 class SimplePipeTests(unittest.TestCase):
     def tearDown(self):
         for f in (TESTFN, TESTFN2):
@@ -16,7 +19,7 @@
 
     def testSimplePipe1(self):
         t = pipes.Template()
-        t.append('tr a-z A-Z', pipes.STDIN_STDOUT)
+        t.append(s_command, pipes.STDIN_STDOUT)
         f = t.open(TESTFN, 'w')
         f.write('hello world #1')
         f.close()
@@ -25,14 +28,14 @@
     def testSimplePipe2(self):
         file(TESTFN, 'w').write('hello world #2')
         t = pipes.Template()
-        t.append('tr a-z A-Z < $IN > $OUT', pipes.FILEIN_FILEOUT)
+        t.append(s_command + ' < $IN > $OUT', pipes.FILEIN_FILEOUT)
         t.copy(TESTFN, TESTFN2)
         self.assertEqual(open(TESTFN2).read(), 'HELLO WORLD #2')
 
     def testSimplePipe3(self):
         file(TESTFN, 'w').write('hello world #2')
         t = pipes.Template()
-        t.append('tr a-z A-Z < $IN', pipes.FILEIN_STDOUT)
+        t.append(s_command + ' < $IN', pipes.FILEIN_STDOUT)
         self.assertEqual(t.open(TESTFN, 'r').read(), 'HELLO WORLD #2')
 
     def testEmptyPipeline1(self):


More information about the Python-checkins mailing list