def test_missing_quote_yields_error(): with pytest.raises(UntreatedError): split("'") with pytest.raises(UntreatedError): split("'''") with pytest.raises(UntreatedError): split('"') with pytest.raises(UntreatedError): split('"""')
def test_multi_string(): assert split("'''pouet pouet'''") == ["'''pouet pouet'''"]
def test_call(): assert split("function()") == ["function", "(", ")"]
def test_empty(): assert split("") == []
def test_comma_with_words(): assert split("a, b") == ["a", ",", " ", "b"]
def test_several_spaces(): assert split(" ") == [" "]
def test_remove_crap(): assert split("\x0c\xef\xbb\xbf") == []
def test_multi_string_with_same_quotes_in(): assert split('"""pouet " "" pouet"""') == ['"""pouet " "" pouet"""']
def test_hexa(): assert split("0x7F") == ["0x7F"]
def test_other_escape_string(): assert split("'\\\\'") == ["'\\\\'"]
def test_underscore_variable(): assert split("some_variable") == ["some_variable"]
def test_escape_in_string(): assert split("'\\\\'") == ["'\\\\'"]
def test_escape(): assert split("\\\\") == ["\\", "\\"]
def test_multi_string_other_quotes(): assert split('"""pouet pouet"""') == ['"""pouet pouet"""']
def test_backslash_in_comment(): assert split("# pouet \\t pouet\npouet") == ["# pouet \\t pouet", "\n", "pouet"]
def test_comment_backslash(): assert split('# pouet \\\npouet') == ["# pouet \\", "\n", "pouet"]
def test_decorator(): assert split("@pouet") == ["@", "pouet"]
def test_backslash_in_comment(): assert split("# pouet \\t pouet\npouet") == [ "# pouet \\t pouet", "\n", "pouet" ]
def test_several_numbers(): assert split("12 34") == ["12", " ", "34"]
def test_regression(): assert split("(r'[\"\\'](.|\n|\r)*[\"\\']', 'STRING'),") == [ "(", "r", "'[\"\\'](.|\n|\r)*[\"\\']'", ",", " ", "'STRING'", ")", "," ]
def test_dot_with_word(): assert split("a.b") == ["a", ".", "b"]
def test_colon_word(): assert split("pouet;") == ["pouet", ";"]
def test_different_case(): assert split("AbCd cDeF") == ["AbCd", " ", "cDeF"]
def grouper_test(input, split_output, group_output): assert split(input) == split_output assert group(split_output) == group_output
def test_tab_n_space(): assert split(" ") == [" "]
def test_numbers(): assert split("1234") == ["1234"]
def test_regression(): assert split("(r'[\"\\'](.|\n|\r)*[\"\\']', 'STRING'),") == ["(", "r", "'[\"\\'](.|\n|\r)*[\"\\']'", ",", " ", "'STRING'", ")", ","]
def test_comma(): assert split(",") == [","]
def test_dot(): assert split(".") == ["."]
def test_dot_with_words(): assert split("a.b.c") == ["a", ".", "b", ".", "c"]
def test_colon(): assert split(";") == [";"]
def test_assign(): assert split("a = b") == ["a", " ", "=", " ", "b"]
def test_call_with_arg(): assert split("function(a)") == ["function", "(", "a", ")"]
def test_assign_unicode(): assert split("α = β") == ["α", " ", "=", " ", "β"]