Beispiel #1
0
 def _handle_line(self, line, from_ga):
     """Clean the line, split out the colour codes, and feed it to the 
     realm as a metaline.
     """
     line = line.decode(self.factory.encoding)
     metaline = self._colourparser.parseline(make_string_sane(line))
     if from_ga:
         metaline.line_end = 'soft'
     else:
         metaline.line_end = 'hard'
     metaline.wrap = True
     self.factory.realm.metalineReceived(metaline)
Beispiel #2
0
def test_FF_removal():
    s = 'foo\014bar'
    assert make_string_sane(s) == 'foobar'
Beispiel #3
0
def test_removal_of_NUL():
    s = '\000foo\000bar'
    assert make_string_sane(s) == 'foobar'
Beispiel #4
0
def test_HT_then_BS():
    s = 'foo\011\010bar'
    assert make_string_sane(s) == 'foobar'
Beispiel #5
0
def test_VT_removal():
    s = 'foo\013\013bar'
    assert make_string_sane(s) == 'foobar'
Beispiel #6
0
def test_backspace_no_interference():
    #XXX um. Is this even right?
    s = 'fooX\000\010'
    res = make_string_sane(s)
    print res
    assert res == 'foo'
Beispiel #7
0
def test_HT_replacement():
    s = 'foo\011bar'
    assert make_string_sane(s) == 'foo    bar'
Beispiel #8
0
def test_backspace_gone_too_far():
    s = 'foo\010\010\010\010'
    assert make_string_sane(s) == ''
Beispiel #9
0
def test_backspace_handling_no_previous_characters_no_blow_up():
    s = '\010'
    assert make_string_sane(s) == ''
Beispiel #10
0
def test_backspace_handling_multiple():
    s = 'foobaz\010\010\010bar'
    res = make_string_sane(s)
    print res
    assert res == 'foobar'
Beispiel #11
0
def test_backspace_handling_normal():
    s = 'fooX\010'
    res = make_string_sane(s)
    print res
    assert res == 'foo'
Beispiel #12
0
def test_removal_of_BEL():
    s = '\007James\007 Bond'
    assert make_string_sane(s) == 'James Bond'