equal
deleted
inserted
replaced
126 self.assertEqual(['bar/baz/qux.py', 'foo'], list(m)) |
126 self.assertEqual(['bar/baz/qux.py', 'foo'], list(m)) |
127 self.assertEqual(BIN_HASH_2, m['bar/baz/qux.py']) |
127 self.assertEqual(BIN_HASH_2, m['bar/baz/qux.py']) |
128 self.assertEqual('l', m.flags('bar/baz/qux.py')) |
128 self.assertEqual('l', m.flags('bar/baz/qux.py')) |
129 self.assertEqual(BIN_HASH_1, m['foo']) |
129 self.assertEqual(BIN_HASH_1, m['foo']) |
130 self.assertEqual('', m.flags('foo')) |
130 self.assertEqual('', m.flags('foo')) |
131 self.assertRaises(KeyError, lambda : m['wat']) |
131 with self.assertRaises(KeyError): |
|
132 m['wat'] |
132 |
133 |
133 def testParseManifestV2(self): |
134 def testParseManifestV2(self): |
134 m1 = self.parsemanifest(A_SHORT_MANIFEST) |
135 m1 = self.parsemanifest(A_SHORT_MANIFEST) |
135 m2 = self.parsemanifest(A_SHORT_MANIFEST_V2) |
136 m2 = self.parsemanifest(A_SHORT_MANIFEST_V2) |
136 # Should have same content as A_SHORT_MANIFEST |
137 # Should have same content as A_SHORT_MANIFEST |
211 self.assertEqual(h2, m['bar/baz/qux.py']) |
212 self.assertEqual(h2, m['bar/baz/qux.py']) |
212 self.assertEqual(h2, m['beta']) |
213 self.assertEqual(h2, m['beta']) |
213 self.assertEqual('', m.flags('alpha')) |
214 self.assertEqual('', m.flags('alpha')) |
214 self.assertEqual('l', m.flags('bar/baz/qux.py')) |
215 self.assertEqual('l', m.flags('bar/baz/qux.py')) |
215 self.assertEqual('', m.flags('beta')) |
216 self.assertEqual('', m.flags('beta')) |
216 self.assertRaises(KeyError, lambda : m['foo']) |
217 with self.assertRaises(KeyError): |
|
218 m['foo'] |
217 |
219 |
218 def testSetGetNodeSuffix(self): |
220 def testSetGetNodeSuffix(self): |
219 clean = self.parsemanifest(A_SHORT_MANIFEST) |
221 clean = self.parsemanifest(A_SHORT_MANIFEST) |
220 m = self.parsemanifest(A_SHORT_MANIFEST) |
222 m = self.parsemanifest(A_SHORT_MANIFEST) |
221 h = m['foo'] |
223 h = m['foo'] |
253 def filt(path): |
255 def filt(path): |
254 if path == 'foo': |
256 if path == 'foo': |
255 assert False |
257 assert False |
256 return True |
258 return True |
257 match.matchfn = filt |
259 match.matchfn = filt |
258 self.assertRaises(AssertionError, m.matches, match) |
260 with self.assertRaises(AssertionError): |
|
261 m.matches(match) |
259 |
262 |
260 def testRemoveItem(self): |
263 def testRemoveItem(self): |
261 m = self.parsemanifest(A_SHORT_MANIFEST) |
264 m = self.parsemanifest(A_SHORT_MANIFEST) |
262 del m['foo'] |
265 del m['foo'] |
263 self.assertRaises(KeyError, lambda : m['foo']) |
266 with self.assertRaises(KeyError): |
|
267 m['foo'] |
264 self.assertEqual(1, len(m)) |
268 self.assertEqual(1, len(m)) |
265 self.assertEqual(1, len(list(m))) |
269 self.assertEqual(1, len(list(m))) |
266 # now restore and make sure everything works right |
270 # now restore and make sure everything works right |
267 m['foo'] = 'a' * 20 |
271 m['foo'] = 'a' * 20 |
268 self.assertEqual(2, len(m)) |
272 self.assertEqual(2, len(m)) |