Exemple #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)
def test_format_char_tab():
    assert format_char(ord('\t')) == \
        '  9, 0o011, 0x09, HT, ␉, ^I, Horizontal Tab'
def test_format_char_escape():
    assert format_char(ESC) == ' 27, 0o033, 0x1B, ESC, ␛, ^[, Escape'
def test_format_char_space():
    assert format_char(ord(' ')) == ' 32, 0o040, 0x20, SPC'
def test_format_char():
    assert format_char(ord('a')) == ' 97, 0o141, 0x61, a'