Esempio n. 1
0
def _loop_once(fd):
    char: int = _read_char(fd)
    print(format_char(char), end='\r\n')
    if char == 3:  # ^C
        sys.exit(0)
Esempio n. 2
0
def test_format_char_tab():
    assert format_char(ord('\t')) == \
        '  9, 0o011, 0x09, HT, ␉, ^I, Horizontal Tab'
Esempio n. 3
0
def test_format_char_escape():
    assert format_char(ESC) == ' 27, 0o033, 0x1B, ESC, ␛, ^[, Escape'
Esempio n. 4
0
def test_format_char_space():
    assert format_char(ord(' ')) == ' 32, 0o040, 0x20, SPC'
Esempio n. 5
0
def test_format_char():
    assert format_char(ord('a')) == ' 97, 0o141, 0x61, a'