def test_if_else_implict( assert_errors, default_options, parse_tokens, ): """Testing to make sure implicit if works.""" tokens = parse_tokens(code_implict_if_else) visitor = IfElseVisitor(default_options, tokens) visitor.run() assert_errors(visitor, [ImplicitElifViolation])
def test_if_else_one_line( assert_errors, default_options, parse_tokens, ): """Testing to see if ``if`` statement code is on one line.""" tokens = parse_tokens(code_that_breaks) visitor = IfElseVisitor(default_options, tokens) visitor.run() assert_errors(visitor, [ImplicitElifViolation])
def test_false_positives_are_ignored( code, assert_errors, parse_tokens, default_options, ): """Testing regular conditions.""" file_tokens = parse_tokens(code, do_compile=False) visitor = IfElseVisitor(default_options, file_tokens=file_tokens) visitor.run() assert_errors(visitor, [])
def test_implicit_elif_statements( code, assert_errors, parse_tokens, default_options, ): """Testing implicit `elif` conditions.""" file_tokens = parse_tokens(code) visitor = IfElseVisitor(default_options, file_tokens=file_tokens) visitor.run() assert_errors(visitor, [ImplicitElifViolation])
def test_correct_if_statements( code, assert_errors, parse_tokens, default_options, ): """Testing regular conditions.""" file_tokens = parse_tokens(code) visitor = IfElseVisitor(default_options, file_tokens=file_tokens) visitor.run() assert_errors(visitor, [])