From 6ae8cb053b78effdeda1d9ba5966086e02befc9a Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 18 Feb 2010 22:11:49 +0100 Subject: keyparser: swapped argument order in KeyMap.add() --- test/tc_newkeys.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'test') diff --git a/test/tc_newkeys.py b/test/tc_newkeys.py index 697bfdcb..0bc99de1 100644 --- a/test/tc_newkeys.py +++ b/test/tc_newkeys.py @@ -50,9 +50,9 @@ class Test(PressTestCase): return arg.n return fnc - km.add(n(5), 'ppp') - km.add(n(8), 'pp') - km.add(n(2), 'pp') + km.add('ppp', n(5)) + km.add('pp', n(8)) + km.add('pp', n(2)) directions.add('j', dir=Direction(down=1)) press = self._mkpress(kb, km) @@ -118,16 +118,16 @@ class Test(PressTestCase): directions.add('', alias='j') base = KeyMap() - base.add(add_dirs, 'a') - base.add(add_dirs, 'b') - base.add(add_dirs, 'xx') - base.add(return5, 'f') + base.add('a', add_dirs) + base.add('b', add_dirs) + base.add('xx', add_dirs) + base.add('f', return5) base.add('yy', alias='y') base.add('!', alias='!') other = KeyMap() other.add('bb', alias='xx') - other.add(add_dirs, 'c') + other.add('c', add_dirs) other.add('g', alias='f') km = base.merge(other) @@ -248,7 +248,7 @@ class Test(PressTestCase): def test_add(self): c = KeyMap() - c.add(lambda *_: 'lolz', 'aa', 'b') + c.add('aa', 'b', lambda *_: 'lolz') self.assert_(c['aa'].function(), 'lolz') @c.add('a', 'c') def test(): @@ -268,7 +268,7 @@ class Test(PressTestCase): return value return arg.n return fnc - km.add(n(5), 'p') + km.add('p', n(5)) press = self._mkpress(kb, km) self.assertEqual(5, press('p')) self.assertEqual(3, press('3p')) @@ -286,8 +286,8 @@ class Test(PressTestCase): dir = arg.direction is None and Direction(down=1) \ or arg.direction return n * dir.down - km.add(nd, 'd') - km.add('dd', func=nd, with_direction=False) + km.add('d', nd) + km.add('dd', func=nd) press = self._mkpress(kb, km) @@ -302,8 +302,8 @@ class Test(PressTestCase): self.assertEqual( 33, press('33dd')) self.assertEqual( 1, press('dd')) - km.add(nd, 'x') - km.add('xxxx', func=nd, with_direction=False) + km.add('x', nd) + km.add('xxxx', func=nd) self.assertEqual(1, press('xxxxj')) self.assertEqual(1, press('xxxxjsomeinvalitchars')) @@ -328,9 +328,9 @@ class Test(PressTestCase): n = arg.n is None and 1 or arg.n return ''.join(chr(c) for c in arg.matches) * n - km.add(cat, 'return') - km.add(cat, 'cat4') - km.add(cat, 'foo') + km.add('return', cat) + km.add('cat4', cat) + km.add('foo', cat) press = self._mkpress(kb, km) @@ -342,7 +342,7 @@ class Test(PressTestCase): self.assertEqual('x', press('foojx')) self.assertPressFails(kb, 'fooggx') # ANYKEY forbidden in DIRECTION - km.add(lambda _: Ellipsis, '') + km.add('', lambda _: Ellipsis) self.assertEqual('x', press('returnx')) self.assertEqual('abcd', press('cat4abcd')) self.assertEqual(Ellipsis, press('2cat4abcd')) @@ -365,8 +365,8 @@ class Test(PressTestCase): n += dir.down return n - km.add(add_dirs, 'xy') - km.add(add_dirs, 'four') + km.add('xy', add_dirs) + km.add('four', add_dirs) press = self._mkpress(kb, km) @@ -383,7 +383,7 @@ class Test(PressTestCase): press = self._mkpress(kb, km) directions.add('j', dir=Direction(down=1)) directions.add('k', dir=Direction(down=-1)) - km.add('xxx', func=lambda _: 1) + km.add('xxx', lambda _: 1) self.assertEqual(1, press('xxx')) -- cgit 1.4.1-2-gfad0