Rev 3164: Test for errors on unknown kinds. in http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled

Robert Collins robertc at robertcollins.net
Thu Jan 3 21:30:49 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/inventory.journalled

------------------------------------------------------------
revno: 3164
revision-id:robertc at robertcollins.net-20080103213044-ybeefdleu2fv7lfe
parent: robertc at robertcollins.net-20080103212603-u08eyfs5vn8po8yu
committer: Robert Collins <robertc at robertcollins.net>
branch nick: inventory.journalled
timestamp: Fri 2008-01-04 08:30:44 +1100
message:
  Test for errors on unknown kinds.
modified:
  bzrlib/tests/test_journalled_inv.py test_journalled_inv.-20080103012121-ny2w9slze5jgty8i-1
=== modified file 'bzrlib/tests/test_journalled_inv.py'
--- a/bzrlib/tests/test_journalled_inv.py	2008-01-03 21:26:03 +0000
+++ b/bzrlib/tests/test_journalled_inv.py	2008-01-03 21:30:44 +0000
@@ -132,7 +132,23 @@
         self.assertRaises(errors.BzrError,
             journal.delta_to_lines, NULL_REVISION, delta)
 
-# unknown kind raises
+    def test_unknown_kind_errors(self):
+        old_inv = Inventory(None)
+        new_inv = Inventory(None)
+        root = new_inv.make_entry('directory', '', None, 'my-rich-root-id')
+        root.revision = 'changed'
+        new_inv.add(root)
+        non_root = new_inv.make_entry('directory', 'foo', root.file_id, 'id')
+        non_root.revision = 'changed'
+        non_root.kind = 'strangelove'
+        new_inv.add(non_root)
+        delta = self.make_inv_delta(old_inv, new_inv)
+        journal = journalled_inventory.InventoryJournal(versioned_root=True)
+        # we expect keyerror because there is little value wrapping this.
+        # This test aims to prove that it errors more than how it errors.
+        self.assertRaises(KeyError,
+            journal.delta_to_lines, NULL_REVISION, delta)
+
 # tree-reference when not enabled
 
 class TestContent(TestCase):



More information about the bazaar-commits mailing list