def test_py2(): """Test python2.x methods.""" value = Color("{red}this is a test.{/red}") assert "\033[31m \033[39m" == Color("{red} {/red}", "latin-1") assert "\033[31mabc\033[39m" == Color("{red}\x80abc{/red}", errors="ignore") assert "\033[31mthis is a test.\033[39m" == value.decode() assert "\033[31mth3s 3s 1 t2st.\033[39m" == value.translate(string.maketrans("aeioum", "123456").decode("latin-1"))
def test_py2(): """Test python2.x methods.""" value = Color('this is a test.') assert ' ' == Color(' ', 'latin-1') assert 'abc' == Color('\x80abc', errors='ignore') assert 'this is a test.' == value.decode() assert 'th3s 3s 1 t2st.' == value.translate(string.maketrans('aeiou', '12345').decode('latin-1'))