[pypy-commit] pyrepl codecheck-clean: more codecheck cleans

RonnyPfannschmidt noreply at buildbot.pypy.org
Sun Feb 10 00:55:20 CET 2013


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: codecheck-clean
Changeset: r222:099eed38e5fd
Date: 2013-01-15 23:13 +0100
http://bitbucket.org/pypy/pyrepl/changeset/099eed38e5fd/

Log:	more codecheck cleans

diff --git a/pyrepl/unix_eventqueue.py b/pyrepl/unix_eventqueue.py
--- a/pyrepl/unix_eventqueue.py
+++ b/pyrepl/unix_eventqueue.py
@@ -100,7 +100,7 @@
         self.events.append(event)
 
     def push(self, char):
-        self.buf.append(char)
+        self.buf.append(ord(char))
         if char in self.k:
             if self.k is self.ck:
                 #sanity check, buffer is empty when a special key comes
diff --git a/testing/infrastructure.py b/testing/infrastructure.py
--- a/testing/infrastructure.py
+++ b/testing/infrastructure.py
@@ -21,11 +21,15 @@
 from pyrepl.reader import Reader
 from pyrepl.console import Console, Event
 
+
 class EqualsAnything(object):
     def __eq__(self, other):
         return True
+
+
 EA = EqualsAnything()
 
+
 class TestConsole(Console):
     height = 24
     width = 80
@@ -38,7 +42,7 @@
 
     def refresh(self, screen, xy):
         if self.next_screen is not None:
-                assert screen == self.next_screen, "[ %s != %s after %r ]"%(
+                assert screen == self.next_screen, "[ %s != %s after %r ]" % (
                     screen, self.next_screen, self.last_event_name)
 
     def get_event(self, block=1):
diff --git a/testing/test_basic.py b/testing/test_basic.py
--- a/testing/test_basic.py
+++ b/testing/test_basic.py
@@ -24,23 +24,27 @@
     read_spec([(('self-insert', 'a'), ['a']),
                ( 'accept',            ['a'])])
 
+
 def test_repeat():
     read_spec([(('digit-arg', '3'),   ['']),
                (('self-insert', 'a'), ['aaa']),
                ( 'accept',            ['aaa'])])
 
+
 def test_kill_line():
     read_spec([(('self-insert', 'abc'), ['abc']),
                ( 'left',                None),
                ( 'kill-line',           ['ab']),
                ( 'accept',              ['ab'])])
 
+
 def test_unix_line_discard():
     read_spec([(('self-insert', 'abc'), ['abc']),
                ( 'left',                None),
                ( 'unix-word-rubout',    ['c']),
                ( 'accept',              ['c'])])
 
+
 def test_kill_word():
     read_spec([(('self-insert', 'ab cd'), ['ab cd']),
                ( 'beginning-of-line',     ['ab cd']),
diff --git a/testing/test_bugs.py b/testing/test_bugs.py
--- a/testing/test_bugs.py
+++ b/testing/test_bugs.py
@@ -25,13 +25,17 @@
 
 import pytest
 
+
 class HistoricalTestReader(HistoricalReader, TestReader):
     pass
 
+
 @pytest.mark.xfail(reason='event missing', run=False)
 def test_transpose_at_start():
-    read_spec([( 'transpose', [EA, '']),
-               ( 'accept',    [''])])
+    read_spec([
+        ('transpose', [EA, '']),
+        ('accept',    [''])])
+
 
 def test_cmd_instantiation_crash():
     spec = [
diff --git a/testing/test_functional.py b/testing/test_functional.py
--- a/testing/test_functional.py
+++ b/testing/test_functional.py
@@ -6,6 +6,7 @@
 import pytest
 import sys
 
+
 def pytest_funcarg__child(request):
     try:
         pexpect = pytest.importorskip('pexpect')
@@ -17,8 +18,8 @@
     child.sendline('main()')
     return child
 
+
 def test_basic(child):
     child.sendline('a = 3')
     child.sendline('a')
     child.expect('3')
-
diff --git a/testing/test_keymap.py b/testing/test_keymap.py
--- a/testing/test_keymap.py
+++ b/testing/test_keymap.py
@@ -1,4 +1,3 @@
-import pytest
 from pyrepl.keymap import compile_keymap
 
 
diff --git a/testing/test_readline.py b/testing/test_readline.py
--- a/testing/test_readline.py
+++ b/testing/test_readline.py
@@ -1,11 +1,13 @@
 from pyrepl.readline import _ReadlineWrapper
-import os, pty
+import os
+import pty
+
 
 def test_raw_input():
     readline_wrapper = _ReadlineWrapper()
     master, slave = pty.openpty()
     readline_wrapper.f_in = slave
-    os.write(master, 'input\n')
+    os.write(master, b'input\n')
     result = readline_wrapper.raw_input('prompt:')
     assert result == 'input'
     # A bytes string on python2, a unicode string on python3.
diff --git a/testing/test_unix_reader.py b/testing/test_unix_reader.py
--- a/testing/test_unix_reader.py
+++ b/testing/test_unix_reader.py
@@ -1,6 +1,7 @@
 from __future__ import unicode_literals
 from pyrepl.unix_eventqueue import EncodedQueue
 
+
 def test_simple():
     q = EncodedQueue({}, 'utf-8')
 
@@ -13,4 +14,3 @@
     assert q.get() is None
     assert event.data == a
     assert event.raw == b
-


More information about the pypy-commit mailing list