[pypy-commit] pyrepl codecheck-clean: final testing codecheck fixes
RonnyPfannschmidt
noreply at buildbot.pypy.org
Sun Feb 10 00:55:21 CET 2013
Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: codecheck-clean
Changeset: r223:f37cfe591296
Date: 2013-01-15 23:19 +0100
http://bitbucket.org/pypy/pyrepl/changeset/f37cfe591296/
Log: final testing codecheck fixes
diff --git a/testing/infrastructure.py b/testing/infrastructure.py
--- a/testing/infrastructure.py
+++ b/testing/infrastructure.py
@@ -55,18 +55,19 @@
print("event", ev)
return Event(*ev)
+
class TestReader(Reader):
def get_prompt(self, lineno, cursor_on_line):
return ''
-
+
def refresh(self):
Reader.refresh(self)
self.dirty = True
+
def read_spec(test_spec, reader_class=TestReader):
# remember to finish your test_spec with 'accept' or similar!
con = TestConsole(test_spec, verbose=True)
reader = reader_class(con)
reader.readline()
-
diff --git a/testing/test_basic.py b/testing/test_basic.py
--- a/testing/test_basic.py
+++ b/testing/test_basic.py
@@ -51,18 +51,21 @@
( 'kill-word', [' cd']),
( 'accept', [' cd'])])
+
def test_backward_kill_word():
read_spec([(('self-insert', 'ab cd'), ['ab cd']),
( 'backward-kill-word', ['ab ']),
( 'accept', ['ab '])])
+
def test_yank():
read_spec([(('self-insert', 'ab cd'), ['ab cd']),
( 'backward-kill-word', ['ab ']),
( 'beginning-of-line', ['ab ']),
( 'yank', ['cdab ']),
( 'accept', ['cdab '])])
-
+
+
def test_yank_pop():
read_spec([(('self-insert', 'ab cd'), ['ab cd']),
( 'backward-kill-word', ['ab ']),
@@ -72,18 +75,20 @@
( 'yank-pop', ['cd ']),
( 'accept', ['cd '])])
+
def test_interrupt():
with pytest.raises(KeyboardInterrupt):
- read_spec([( 'interrupt', [''])])
+ read_spec([('interrupt', [''])])
+
# test_suspend -- hah
-
def test_up():
read_spec([(('self-insert', 'ab\ncd'), ['ab', 'cd']),
( 'up', ['ab', 'cd']),
(('self-insert', 'e'), ['abe', 'cd']),
( 'accept', ['abe', 'cd'])])
+
def test_down():
read_spec([(('self-insert', 'ab\ncd'), ['ab', 'cd']),
( 'up', ['ab', 'cd']),
@@ -92,12 +97,14 @@
(('self-insert', 'f'), ['abe', 'cdf']),
( 'accept', ['abe', 'cdf'])])
+
def test_left():
read_spec([(('self-insert', 'ab'), ['ab']),
( 'left', ['ab']),
(('self-insert', 'c'), ['acb']),
( 'accept', ['acb'])])
+
def test_right():
read_spec([(('self-insert', 'ab'), ['ab']),
( 'left', ['ab']),
@@ -105,4 +112,3 @@
( 'right', ['acb']),
(('self-insert', 'd'), ['acbd']),
( 'accept', ['acbd'])])
-
diff --git a/testing/test_readline.py b/testing/test_readline.py
--- a/testing/test_readline.py
+++ b/testing/test_readline.py
@@ -12,4 +12,3 @@
assert result == 'input'
# A bytes string on python2, a unicode string on python3.
assert isinstance(result, str)
-
More information about the pypy-commit
mailing list