summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-10-31 19:40:17 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-10-31 19:40:17 (GMT)
commit9289bfcf54cfbfcf0bdc6cc61244adc38b03494b (patch)
tree83e0c1a4b8e616f534b10a82718bc5f688c73783
parent0b48954cd856e0391acefb6355a4ab98e5f7b3c0 (diff)
downloadcpython-9289bfcf54cfbfcf0bdc6cc61244adc38b03494b.zip
cpython-9289bfcf54cfbfcf0bdc6cc61244adc38b03494b.tar.gz
cpython-9289bfcf54cfbfcf0bdc6cc61244adc38b03494b.tar.bz2
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.
-rw-r--r--Lib/test/test_dumbdbm.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_dumbdbm.py b/Lib/test/test_dumbdbm.py
index 44bb369..3553c19 100644
--- a/Lib/test/test_dumbdbm.py
+++ b/Lib/test/test_dumbdbm.py
@@ -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)