def format_char(char: int): """Format a char for printing.""" if asciilib.is_printable(char): return _format_printable(char) else: return _format_control(char)
def test_is_printable_space(): assert asciilib.is_printable(ord(' '))
def test_is_printable(): assert asciilib.is_printable(ord('a'))
def test_not_is_printable_escape(): assert not asciilib.is_printable(ESC)
def test_not_is_printable_newline(): assert not asciilib.is_printable(ord('\n'))
def test_not_is_printable_tab(): assert not asciilib.is_printable(ord('\t'))