[Python-checkins] python/dist/src/Lib/test test_dumbdbm.py, 1.10, 1.10.10.1

akuchling@users.sourceforge.net akuchling at users.sourceforge.net
Tue Jun 7 21:57:03 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14062/Lib/test
Modified Files:
 Tag: release24-maint
	test_dumbdbm.py 
Log Message:
[Bug #1172763] dumbdbm uses eval() on lines, so it chokes if there's an extra \r on the end of a line; fixed by stripping off trailing whitespace.
Index: test_dumbdbm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dumbdbm.py,v
retrieving revision 1.10
retrieving revision 1.10.10.1
diff -u -d -r1.10 -r1.10.10.1
--- test_dumbdbm.py	13 Jul 2003 17:21:10 -0000	1.10
+++ test_dumbdbm.py	7 Jun 2005 19:57:01 -0000	1.10.10.1
@@ -74,6 +74,24 @@
 self.assertEqual(f['1'], 'hello2')
 f.close()
 
+ def test_line_endings(self):
+ # test for bug #1172763: dumbdbm would die if the line endings
+ # weren't what was expected.
+ f = dumbdbm.open(_fname)
+ f['1'] = 'hello'
+ f['2'] = 'hello2'
+ f.close()
+
+ # Mangle the file by adding \r before each newline
+ data = open(_fname + '.dir').read()
+ data = data.replace('\n', '\r\n')
+ open(_fname + '.dir', 'wb').write(data)
+ 
+ f = dumbdbm.open(_fname)
+ self.assertEqual(f['1'], 'hello')
+ self.assertEqual(f['2'], 'hello2')
+ 
+ 
 def read_helper(self, f):
 keys = self.keys_helper(f)
 for key in self._dict:


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /