Show More
@@ -50,23 +50,24 class testsimplekeyvaluefile(unittest.Te | |||||
50 |
|
50 | |||
51 | def testinvalidkeys(self): |
|
51 | def testinvalidkeys(self): | |
52 | d = {'0key1': 'value1', 'Key2': 'value2'} |
|
52 | d = {'0key1': 'value1', 'Key2': 'value2'} | |
53 |
|
|
53 | self.assertRaises(error.ProgrammingError, | |
54 | "keys must start with a letter.*"): |
|
54 | scmutil.simplekeyvaluefile(self.vfs, 'kvfile').write, | |
55 | scmutil.simplekeyvaluefile(self.vfs, 'kvfile').write(d) |
|
55 | d) | |
56 | d = {'key1@': 'value1', 'Key2': 'value2'} |
|
56 | d = {'key1@': 'value1', 'Key2': 'value2'} | |
57 |
|
|
57 | self.assertRaises(error.ProgrammingError, | |
58 |
scmutil.simplekeyvaluefile(self.vfs, 'kvfile').write |
|
58 | scmutil.simplekeyvaluefile(self.vfs, 'kvfile').write, | |
|
59 | d) | |||
59 |
|
60 | |||
60 | def testinvalidvalues(self): |
|
61 | def testinvalidvalues(self): | |
61 | d = {'key1': 'value1', 'Key2': 'value2\n'} |
|
62 | d = {'key1': 'value1', 'Key2': 'value2\n'} | |
62 |
|
|
63 | self.assertRaises(error.ProgrammingError, | |
63 |
scmutil.simplekeyvaluefile(self.vfs, 'kvfile').write |
|
64 | scmutil.simplekeyvaluefile(self.vfs, 'kvfile').write, | |
|
65 | d) | |||
64 |
|
66 | |||
65 | def testcorruptedfile(self): |
|
67 | def testcorruptedfile(self): | |
66 | self.vfs.contents['badfile'] = 'ababagalamaga\n' |
|
68 | self.vfs.contents['badfile'] = 'ababagalamaga\n' | |
67 |
|
|
69 | self.assertRaises(error.CorruptedState, | |
68 | "dictionary.*element.*"): |
|
70 | scmutil.simplekeyvaluefile(self.vfs, 'badfile').read) | |
69 | scmutil.simplekeyvaluefile(self.vfs, 'badfile').read() |
|
|||
70 |
|
71 | |||
71 | if __name__ == "__main__": |
|
72 | if __name__ == "__main__": | |
72 | silenttestrunner.main(__name__) |
|
73 | silenttestrunner.main(__name__) |
General Comments 0
You need to be logged in to leave comments.
Login now