[Python-3000-checkins] r58734 - python/branches/py3k/Lib/test/test_dumbdbm.py

christian.heimes python-3000-checkins at python.org
Wed Oct 31 20:40:17 CET 2007


Author: christian.heimes
Date: Wed Oct 31 20:40:17 2007
New Revision: 58734

Modified:
   python/branches/py3k/Lib/test/test_dumbdbm.py
Log:
Fixed test_dumbdbm
The test failed on Windows. I hope the change follows the spirit of the test. On Unix it checks if dumbdbm can handle Windows line separators and on Windows it tests with Unix line separators.

Modified: python/branches/py3k/Lib/test/test_dumbdbm.py
==============================================================================
--- python/branches/py3k/Lib/test/test_dumbdbm.py	(original)
+++ python/branches/py3k/Lib/test/test_dumbdbm.py	Wed Oct 31 20:40:17 2007
@@ -113,9 +113,12 @@
         f[b'2'] = b'hello2'
         f.close()
 
-        # Mangle the file by adding \r before each newline
+        # Mangle the file by changing the line separator to Windows or Unix
         data = io.open(_fname + '.dir', 'rb').read()
-        data = data.replace(b'\n', b'\r\n')
+        if os.linesep == b'\n':
+            data = data.replace(b'\n', b'\r\n')
+        else:
+            data = data.replace(b'\r\n', b'\n')
         io.open(_fname + '.dir', 'wb').write(data)
 
         f = dumbdbm.open(_fname)


More information about the Python-3000-checkins mailing list