tests/test-manifest.py
changeset 24655 528ace39c85c
parent 24654 9d6db63ccf00
child 24656 29c238e4a58a
equal deleted inserted replaced
24654:9d6db63ccf00 24655:528ace39c85c
    93     'file%d\0%s%s\n' % (i, h, f) for i, h, f in
    93     'file%d\0%s%s\n' % (i, h, f) for i, h, f in
    94     itertools.izip(xrange(200001),
    94     itertools.izip(xrange(200001),
    95                    itertools.cycle((HASH_1, HASH_2)),
    95                    itertools.cycle((HASH_1, HASH_2)),
    96                    itertools.cycle(('', 'x', 'l')))))
    96                    itertools.cycle(('', 'x', 'l')))))
    97 
    97 
    98 class testmanifest(unittest.TestCase):
    98 class basemanifesttests(object):
    99     def parsemanifest(self, text):
    99     def parsemanifest(self, text):
   100         return manifestmod.manifestdict(text)
   100         raise NotImplementedError('parsemanifest not implemented by test case')
   101 
   101 
   102     def assertIn(self, thing, container, msg=None):
   102     def assertIn(self, thing, container, msg=None):
   103         # assertIn new in 2.7, use it if available, otherwise polyfill
   103         # assertIn new in 2.7, use it if available, otherwise polyfill
   104         sup = getattr(unittest.TestCase, 'assertIn', False)
   104         sup = getattr(unittest.TestCase, 'assertIn', False)
   105         if sup:
   105         if sup:
   454 
   454 
   455         self.assertEqual(
   455         self.assertEqual(
   456                 ['a/b/c/bar.txt', 'a/b/c/foo.txt', 'a/b/d/ten.txt'],
   456                 ['a/b/c/bar.txt', 'a/b/c/foo.txt', 'a/b/d/ten.txt'],
   457                 m2.keys())
   457                 m2.keys())
   458 
   458 
       
   459 class testmanifestdict(unittest.TestCase, basemanifesttests):
       
   460     def parsemanifest(self, text):
       
   461         return manifestmod.manifestdict(text)
       
   462 
   459 if __name__ == '__main__':
   463 if __name__ == '__main__':
   460     silenttestrunner.main(__name__)
   464     silenttestrunner.main(__name__)