diff options
author | hut <hut@lavabit.com> | 2010-02-17 22:44:28 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-03-09 14:40:20 +0100 |
commit | 933463fd93425228e2c1e0439fde75b8167cdbc9 (patch) | |
tree | 9d1c2048879642dc096db15e7938d1dd5f27e3ec | |
parent | c70c915b5ec5a03f0f5b8641322d5c60a1235df5 (diff) | |
download | ranger-933463fd93425228e2c1e0439fde75b8167cdbc9.tar.gz |
keyparser: added test case for tree emrge
-rw-r--r-- | test/tc_newkeys.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/tc_newkeys.py b/test/tc_newkeys.py index 7bdbccad..e8a8dbee 100644 --- a/test/tc_newkeys.py +++ b/test/tc_newkeys.py @@ -437,6 +437,42 @@ class Test(PressTestCase): self.assertRaises(KeyError, t2.traverse, 'abcd') self.assertEqual("Lol", t2.traverse('axy')) + def test_merge_trees(self): + t = Tree() + t.set('aaaX', 1) + t.set('aaaY', 2) + t.set('aaaZ', 3) + t.set('bbbA', 11) + t.set('bbbB', 12) + t.set('bbbC', 13) + t.set('bbbD', 14) + t.set('bP', 21) + t.set('bQ', 22) + + u = Tree() + u.set('aaaX', 0) + u.set('bbbC', 'Yes') + u.set('bbbD', 14) + u.set('bbbE', 15) + u.set('bbbF', 16) + u.set('bQ', 22) + u.set('bR', 23) + + v = t.merge(u) + + self.assertEqual(0, t['aaaX']) + self.assertEqual(1, t['aaaY']) + self.assertEqual(2, t['aaaZ']) + self.assertEqual(11, t['bbbA']) + self.assertEqual('Yes', t['bbbC']) + self.assertEqual(14, t['bbbD']) + self.assertEqual(15, t['bbbE']) + self.assertEqual(16, t['bbbF']) + self.assertRaises(KeyError, t.__getitem__, 'bbbG') + self.assertEqual(21, t['bP']) + self.assertEqual(22, t['bQ']) + self.assertEqual(21, t['bR']) + def test_add(self): c = KeyMap() c.add(lambda *_: 'lolz', 'aa', 'b') |