def test_get_format(): assert get_format("bold") == "\x02"
def test_invalid_format(): with pytest.raises(KeyError) as excinfo: get_format("cake") assert 'not found in the list of available formats' in str(excinfo.value)