Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Side by Side Diff: Lib/test/test_dbm.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_cprofile.py ('k') | Lib/test/test_descr.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! /usr/bin/env python3 1 #! /usr/bin/env python3
2 """Test script for the dbm.open function based on testdumbdbm.py""" 2 """Test script for the dbm.open function based on testdumbdbm.py"""
3 3
4 import os 4 import os
5 import unittest 5 import unittest
6 import glob 6 import glob
7 import test.support 7 import test.support
8 8
9 # Skip tests if dbm module doesn't exist. 9 # Skip tests if dbm module doesn't exist.
10 dbm = test.support.import_module('dbm') 10 dbm = test.support.import_module('dbm')
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 def test_anydbm_creation(self): 65 def test_anydbm_creation(self):
66 f = dbm.open(_fname, 'c') 66 f = dbm.open(_fname, 'c')
67 self.assertEqual(list(f.keys()), []) 67 self.assertEqual(list(f.keys()), [])
68 for key in self._dict: 68 for key in self._dict:
69 f[key.encode("ascii")] = self._dict[key] 69 f[key.encode("ascii")] = self._dict[key]
70 self.read_helper(f) 70 self.read_helper(f)
71 f.close() 71 f.close()
72 72
73 def test_anydbm_creation_n_file_exists_with_invalid_contents(self): 73 def test_anydbm_creation_n_file_exists_with_invalid_contents(self):
74 # create an empty file 74 with open(_fname, "w") as w:
75 test.support.create_empty_file(_fname) 75 pass # create an empty file
76 76
77 f = dbm.open(_fname, 'n') 77 f = dbm.open(_fname, 'n')
78 self.addCleanup(f.close) 78 self.addCleanup(f.close)
79 self.assertEqual(len(f), 0) 79 self.assertEqual(len(f), 0)
80 80
81 def test_anydbm_modification(self): 81 def test_anydbm_modification(self):
82 self.init_db() 82 self.init_db()
83 f = dbm.open(_fname, 'c') 83 f = dbm.open(_fname, 'c')
84 self._dict['g'] = f[b'g'] = b"indented" 84 self._dict['g'] = f[b'g'] = b"indented"
85 self.read_helper(f) 85 self.read_helper(f)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 def test_main(): 172 def test_main():
173 classes = [WhichDBTestCase] 173 classes = [WhichDBTestCase]
174 for mod in dbm_iterator(): 174 for mod in dbm_iterator():
175 classes.append(type("TestCase-" + mod.__name__, (AnyDBMTestCase,), 175 classes.append(type("TestCase-" + mod.__name__, (AnyDBMTestCase,),
176 {'module': mod})) 176 {'module': mod}))
177 test.support.run_unittest(*classes) 177 test.support.run_unittest(*classes)
178 178
179 if __name__ == "__main__": 179 if __name__ == "__main__":
180 test_main() 180 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_cprofile.py ('k') | Lib/test/test_descr.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+