InventoryEntry attributes

Jan Hudec bulb at ucw.cz
Mon May 8 23:24:09 BST 2006


Hello,

I already reported on the way InventoryLink.symlink_target is used in
InventoryEntry and works because the other entries don't have __slots__. Now
I've found a related issue.

There is a test, test_inv.TestInventoryEntry.test_dir_detect_changes, that
reads:

    def test_dir_detect_changes(self):
        left = inventory.InventoryDirectory('123', 'hello.c', ROOT_ID)
        left.text_sha1 = 123
        left.executable = True
        left.symlink_target='foo'
        right = inventory.InventoryDirectory('123', 'hello.c', ROOT_ID)
        right.text_sha1 = 321
        right.symlink_target='bar'
        self.assertEqual((False, False), left.detect_changes(right))
        self.assertEqual((False, False), right.detect_changes(left))

In other words, it sets 3 parameters that InventoryDirectory should not have
at all (which works because InventoryEntry does not declare __slots__, so it
can have attributes added) and checks whether they are ignored.

It also happens further down the line where InventoryLink entry get's it's
executable flag set (and is tested whether it ignores it).

But shouldn't it rather be an error to set these attributes?

-- 
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060509/500c1b00/attachment.pgp 


More information about the bazaar mailing list