[MERGE] Shelf 1 / 5: TreeTransform serialization

John Arbash Meinel john at arbash-meinel.com
Sun Oct 26 15:07:42 GMT 2008

Hash: SHA1

Aaron Bentley wrote:
> John Arbash Meinel wrote:
>> Aaron Bentley wrote:
>>> Yet I agree that some direct tests of serialize and deserialize make sense.
>>> So deserialize can be exercised by passing in a manually-constructed
>>> list of records.  serialize can be exercised with an implementation of
>>> Pack that simply creates a list of records.
>>> Does that seem right to you?
>> That seems ok. I think Robert's idea is fine as well, though I'm
>> thinking we should probably still be asserting the pack format you want
>> to be using. It just depends how strong you want to guarantee that
>> different versions of bzr can re-use the shelf contents.
> Here's a new version that tests serialization and deserialization
> directly.  Since it doesn't use a particular on-disk format, I'm not
> testing an on-disk format.
> I've also changed the test so that unicode symlink targets are created.
>  (Strangely, they always come back in utf-8)

I'm pretty sure that's why it is broken. We don't have the logic in
place as to when to encode and decode at appropriate times.

Because of this, I'm not 100% sure if we want to test it at this level
yet. I suppose it is something we'll want to work correctly in the
future, so having a test that asserts the current behavior, possibly
with a comment that this should be updated when we fix things?

> If you still feel that it makes sense to test a particular on-disk
> format in this thread, please let me know why.
> Aaron

+    def test_serialize_creation(self):
+        tt = self.get_preview()
+        tt.new_file(u'foo\u1234', tt.root, 'bar', 'baz', True)
+        tt.new_directory('qux', tt.root, 'quxx')
+        records = tt.serialize(FakeSerializer())
+        self.assertEqual(self.creation_records(), list(records))

^- Isn't this assertEqual what your "assertSerializeTo" is for? So it
would be:

self.assertSerializeTo(self.creation_records(), tt)

You have this here as well:
+    def test_serialize_symlink_creation(self):

I didn't look over anything but the tests, as I assume it is the same as


Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the bazaar mailing list