mirror of
https://github.com/python/cpython.git
synced 2026-01-04 06:22:20 +00:00
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.
This commit is contained in:
parent
0b48954cd8
commit
9289bfcf54
1 changed files with 5 additions and 2 deletions
|
|
@ -113,9 +113,12 @@ def test_line_endings(self):
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue