summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/container/keymap.py9
-rw-r--r--test/tc_newkeys.py19
2 files changed, 14 insertions, 14 deletions
diff --git a/ranger/container/keymap.py b/ranger/container/keymap.py
index ab87ae36..b718c2a7 100644
--- a/ranger/container/keymap.py
+++ b/ranger/container/keymap.py
@@ -313,12 +313,3 @@ class KeyBuffer(object):
 	def __str__(self):
 		"""returns a concatenation of all characters"""
 		return "".join(to_string(c) for c in self.all_keys)
-
-	def simulate_press(self, string):
-		for char in parse_keybinding(string):
-			self.add(char)
-			if self.done:
-				return self.command
-			if self.failure:
-				break
-		return self.command
diff --git a/test/tc_newkeys.py b/test/tc_newkeys.py
index 06345450..9bfb43b0 100644
--- a/test/tc_newkeys.py
+++ b/test/tc_newkeys.py
@@ -23,12 +23,21 @@ from ranger.ext.keybinding_parser import parse_keybinding
 
 import sys
 
+def simulate_press(self, string):
+	for char in parse_keybinding(string):
+		self.add(char)
+		if self.done:
+			return self.command
+		if self.failure:
+			break
+	return self.command
+
 class PressTestCase(TestCase):
 	"""Some useful methods for the actual test"""
 	def _mkpress(self, keybuffer, _=0):
 		def press(keys):
 			keybuffer.clear()
-			match = keybuffer.simulate_press(keys)
+			match = simulate_press(keybuffer, keys)
 			self.assertFalse(keybuffer.failure,
 					"parsing keys '"+keys+"' did fail!")
 			self.assertTrue(keybuffer.done,
@@ -41,13 +50,13 @@ class PressTestCase(TestCase):
 
 	def assertPressFails(self, kb, keys):
 		kb.clear()
-		kb.simulate_press(keys)
+		simulate_press(kb, keys)
 		self.assertTrue(kb.failure, "Keypress did not fail as expected")
 		kb.clear()
 
 	def assertPressIncomplete(self, kb, keys):
 		kb.clear()
-		kb.simulate_press(keys)
+		simulate_press(kb, keys)
 		self.assertFalse(kb.failure, "Keypress failed, expected incomplete")
 		self.assertFalse(kb.done, "Keypress done which was unexpected")
 		kb.clear()
@@ -78,7 +87,7 @@ class Test(PressTestCase):
 		self.assertEqual(2, press('ppj'))
 
 		kb.clear()
-		match = kb.simulate_press('pp')
+		match = simulate_press(kb, 'pp')
 		args = CommandArgs(0, 0, kb)
 		self.assert_(match)
 		self.assert_(match.function)
@@ -414,7 +423,7 @@ class Test(PressTestCase):
 		self.assertPressIncomplete(kb, 'xx')
 		self.assertPressIncomplete(kb, 'x')
 		if not sys.flags.optimize:
-			self.assertRaises(AssertionError, kb.simulate_press, 'xxx')
+			self.assertRaises(AssertionError, simulate_press, kb, 'xxx')
 		kb.clear()
 
 	def test_directions_as_functions(self):
'#n213'>213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237