示例#1
0
def test_name_token():
    assert _get_tokens([]) == []
    for processor in processors:
        tokens = _get_tokens(['aragorn'])
        tokens = processor(tokens)
        text = untokenize(tokens)
        assert text == 'aragorn'
示例#2
0
def test_no_tokens():
    assert _get_tokens([]) == []
    for processor in processors:
        assert processor([]) == []
示例#3
0
def test_extract_class_name():
    tokens = _get_tokens(['class LOL', 'pass'])
    tokens = _extract_def_name(tokens)
    text = untokenize(tokens)
    assert text.lstrip() == 'LOL'
示例#4
0
def test_extract_decorator_args_no_call():
    tokens = _get_tokens(['@deal.safe'])
    tokens = _extract_decorator_args(tokens)
    text = untokenize(tokens)
    assert text == ' deal.safe'
示例#5
0
def test_extract_lambda_body_no_lambda():
    tokens = _get_tokens(['lambda x'])
    tokens = _extract_lambda_body(tokens)
    text = untokenize(tokens)
    assert text == 'lambda x'
示例#6
0
def test_extract_assignment_no_assigment():
    tokens = _get_tokens(['aragorn'])
    tokens = _extract_assignment(tokens)
    text = untokenize(tokens)
    assert text == 'aragorn'