[MERGE] Update to bzr.dev.
Andrew Bennetts
andrew at canonical.com
Wed Jun 18 06:30:47 BST 2008
I think now all the test changes have been reviewed by either me or Martin.
Robert Collins wrote:
> === modified file 'bzrlib/tests/test_knit.py'
[...]
> - access = _KnitAccess(transport, 'filename', None, None, False, False)
> - data = _KnitData(access=access)
> - records = [('rev-id-1', (None, 0, len(gz_txt)))]
> -
> - contents = data.read_records(records)
> - self.assertEqual({'rev-id-1':(['foo\n', 'bar\n'], sha1sum)}, contents)
> -
> - raw_contents = list(data.read_records_iter_raw(records))
> - self.assertEqual([('rev-id-1', gz_txt, sha1sum)], raw_contents)
> + access = _KnitKeyAccess(transport, ConstantMapper('filename'))
> + knit = KnitVersionedFiles(None, access)
> + records = [(('rev-id-1',), (('rev-id-1',), 0, len(gz_txt)))]
> +
> + contents = list(knit._read_records_iter(records))
> + self.assertEqual([(('rev-id-1',), ['foo\n', 'bar\n'],
> + '4e48e2c9a3d2ca8a708cb0cc545700544efb5021')], contents)
> +
> + raw_contents = list(knit._read_records_iter_raw(records))
> + self.assertEqual([(('rev-id-1',), gz_txt, sha1sum)], raw_contents)
'4e48e2c9a3d2ca8a708cb0cc545700544efb5021' is the same as the sha1sum variable
as far as I can tell, so I think you ought to use sha1sum rather than
the string literal.
[...]
> + # call[1][1] is a StringIO - we can't test it by simple equality.
> + self.assertEqual('put_file_non_atomic', call[0])
> + self.assertEqual('filename.kndx', call[1][0])
> + # With no history, _KndxIndex writes a new index:
> + self.assertEqual(_KndxIndex.HEADER +
> + "\nversion option 0 1 .%s :" % (utf8_revision_id,),
> + call[1][1].getvalue())
> + self.assertEqual({'create_parent_dir': True}, call[2])
This pattern is repeated several times in this file. I think a custom
assertion or other helper might be worthwhile.
> === modified file 'bzrlib/tests/test_merge.py'
> === modified file 'bzrlib/tests/test_remote.py'
> === modified file 'bzrlib/tests/test_repository.py'
> === modified file 'bzrlib/tests/test_selftest.py'
> === modified file 'bzrlib/tests/test_smart.py'
> === modified file 'bzrlib/tests/test_store.py'
These look good.
-Andrew.
More information about the bazaar
mailing list