From 0bc410c523f397f9c46c04ded5b3da1da65a6242 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 13 Jan 2010 23:35:25 +0100 Subject: commandlist: aliases are now references rather than copies --- test/tc_commandlist.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/tc_commandlist.py b/test/tc_commandlist.py index 5062be9f..f1edfa20 100644 --- a/test/tc_commandlist.py +++ b/test/tc_commandlist.py @@ -10,6 +10,7 @@ class Test(TestCase): def test_commandist(self): cl = CL() fnc = lambda arg: 1 + fnc2 = lambda arg: 2 dmy = cl.dummy_object cl.bind(fnc, 'aaaa') @@ -51,14 +52,24 @@ class Test(TestCase): self.assertEqual(dmy, cl['aaa']) self.assertEqual(fnc, cl['aaaa'].execute) + # ------------------------ test aliases cl.alias('aaaa', 'c') cl.rebuild_paths() - self.assertEqual(cl['c'], cl['aaaa']) + + self.assertEqual(cl['c'].execute, cl['aaaa'].execute) + + cl.bind(fnc2, 'aaaa') + cl.rebuild_paths() + + self.assertEqual(cl['c'].execute, cl['aaaa'].execute) + cl.unbind('c') cl.rebuild_paths() - self.assertEqual(fnc, cl['aaaa'].execute) + + self.assertEqual(fnc2, cl['aaaa'].execute) self.assertKeyError(cl, 'c') + # ----------------------- test clearing cl.clear() self.assertKeyError(cl, 'a') self.assertKeyError(cl, 'aa') -- cgit 1.4.1-2-gfad0