Пример #1
0
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('"""')
Пример #2
0
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('"""')
Пример #3
0
def test_multi_string():
    assert split("'''pouet pouet'''") == ["'''pouet pouet'''"]
Пример #4
0
def test_call():
    assert split("function()") == ["function", "(", ")"]
Пример #5
0
def test_empty():
    assert split("") == []
Пример #6
0
def test_comma_with_words():
    assert split("a, b") == ["a", ",", " ", "b"]
Пример #7
0
def test_several_spaces():
    assert split("     ") == ["     "]
Пример #8
0
 def test_remove_crap():
     assert split("\x0c\xef\xbb\xbf") == []
Пример #9
0
def test_multi_string_with_same_quotes_in():
    assert split('"""pouet " "" pouet"""') == ['"""pouet " "" pouet"""']
Пример #10
0
def test_hexa():
    assert split("0x7F") == ["0x7F"]
Пример #11
0
def test_other_escape_string():
    assert split("'\\\\'") == ["'\\\\'"]
Пример #12
0
def test_underscore_variable():
    assert split("some_variable") == ["some_variable"]
Пример #13
0
def test_escape_in_string():
    assert split("'\\\\'") == ["'\\\\'"]
Пример #14
0
def test_escape():
    assert split("\\\\") == ["\\", "\\"]
Пример #15
0
def test_multi_string_other_quotes():
    assert split('"""pouet pouet"""') == ['"""pouet pouet"""']
Пример #16
0
def test_escape():
    assert split("\\\\") == ["\\", "\\"]
Пример #17
0
def test_other_escape_string():
    assert split("'\\\\'") == ["'\\\\'"]
Пример #18
0
def test_multi_string_with_same_quotes_in():
    assert split('"""pouet " "" pouet"""') == ['"""pouet " "" pouet"""']
Пример #19
0
def test_backslash_in_comment():
    assert split("# pouet \\t pouet\npouet") == ["# pouet \\t pouet", "\n", "pouet"]
Пример #20
0
def test_comment_backslash():
    assert split('# pouet \\\npouet') == ["# pouet \\", "\n", "pouet"]
Пример #21
0
def test_decorator():
    assert split("@pouet") == ["@", "pouet"]
Пример #22
0
def test_backslash_in_comment():
    assert split("# pouet \\t pouet\npouet") == [
        "# pouet \\t pouet", "\n", "pouet"
    ]
Пример #23
0
def test_several_numbers():
    assert split("12 34") == ["12", " ", "34"]
Пример #24
0
def test_regression():
    assert split("(r'[\"\\'](.|\n|\r)*[\"\\']', 'STRING'),") == [
        "(", "r", "'[\"\\'](.|\n|\r)*[\"\\']'", ",", " ", "'STRING'", ")", ","
    ]
Пример #25
0
def test_dot_with_word():
    assert split("a.b") == ["a", ".", "b"]
Пример #26
0
 def test_remove_crap():
     assert split("\x0c\xef\xbb\xbf") == []
Пример #27
0
def test_colon_word():
    assert split("pouet;") == ["pouet", ";"]
Пример #28
0
def test_different_case():
    assert split("AbCd cDeF") == ["AbCd", " ", "cDeF"]
Пример #29
0
def grouper_test(input, split_output, group_output):
    assert split(input) == split_output
    assert group(split_output) == group_output
Пример #30
0
def test_decorator():
    assert split("@pouet") == ["@", "pouet"]
Пример #31
0
def test_underscore_variable():
    assert split("some_variable") == ["some_variable"]
Пример #32
0
def test_tab_n_space():
    assert split("	 ") == ["	 "]
Пример #33
0
def test_escape_in_string():
    assert split("'\\\\'") == ["'\\\\'"]
Пример #34
0
def test_several_spaces():
    assert split("     ") == ["     "]
Пример #35
0
def test_hexa():
    assert split("0x7F") == ["0x7F"]
Пример #36
0
def test_numbers():
    assert split("1234") == ["1234"]
Пример #37
0
def test_comment_backslash():
    assert split('# pouet \\\npouet') == ["# pouet \\", "\n", "pouet"]
Пример #38
0
def test_several_numbers():
    assert split("12 34") == ["12", " ", "34"]
Пример #39
0
def test_regression():
    assert split("(r'[\"\\'](.|\n|\r)*[\"\\']', 'STRING'),") == ["(", "r", "'[\"\\'](.|\n|\r)*[\"\\']'", ",", " ", "'STRING'", ")", ","]
Пример #40
0
def test_comma():
    assert split(",") == [","]
Пример #41
0
def test_different_case():
    assert split("AbCd cDeF") == ["AbCd", " ", "cDeF"]
Пример #42
0
def test_comma_with_words():
    assert split("a, b") == ["a", ",", " ", "b"]
Пример #43
0
def test_tab_n_space():
    assert split("	 ") == ["	 "]
Пример #44
0
def test_dot():
    assert split(".") == ["."]
Пример #45
0
def test_numbers():
    assert split("1234") == ["1234"]
Пример #46
0
def test_dot_with_word():
    assert split("a.b") == ["a", ".", "b"]
Пример #47
0
def test_comma():
    assert split(",") == [","]
Пример #48
0
def test_dot_with_words():
    assert split("a.b.c") == ["a", ".", "b", ".", "c"]
Пример #49
0
def test_dot():
    assert split(".") == ["."]
Пример #50
0
def test_colon():
    assert split(";") == [";"]
Пример #51
0
def test_dot_with_words():
    assert split("a.b.c") == ["a", ".", "b", ".", "c"]
Пример #52
0
def test_colon_word():
    assert split("pouet;") == ["pouet", ";"]
Пример #53
0
def test_colon():
    assert split(";") == [";"]
Пример #54
0
def test_empty():
    assert split("") == []
Пример #55
0
def test_assign():
    assert split("a = b") == ["a", " ", "=", " ", "b"]
Пример #56
0
def test_assign():
    assert split("a = b") == ["a", " ", "=", " ", "b"]
Пример #57
0
def test_call_with_arg():
    assert split("function(a)") == ["function", "(", "a", ")"]
Пример #58
0
 def test_assign_unicode():
     assert split("α = β") == ["α", " ", "=", " ", "β"]
Пример #59
0
def grouper_test(input, split_output, group_output):
    assert split(input) == split_output
    assert group(split_output) == group_output
Пример #60
0
def test_multi_string_other_quotes():
    assert split('"""pouet pouet"""') == ['"""pouet pouet"""']