]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fixed test_dumbdbm
authorChristian Heimes <christian@cheimes.de>
Wed, 31 Oct 2007 19:40:17 +0000 (19:40 +0000)
committerChristian Heimes <christian@cheimes.de>
Wed, 31 Oct 2007 19:40:17 +0000 (19:40 +0000)
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.

Lib/test/test_dumbdbm.py

index 44bb36941c957fa9849144ddfb7b387a2ec14ee3..3553c1961dec3cffdcffbffeaf0432f93f7da527 100644 (file)
@@ -113,9 +113,12 @@ class DumbDBMTestCase(unittest.TestCase):
         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)