Skip to content

Commit

Permalink
test: add test_wrong_variable_name_case_insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarnajjar committed Mar 24, 2020
1 parent 17902b3 commit d2ac20e
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,39 @@

from wemake_python_styleguide.violations.naming import (
WrongVariableNameViolation,
UpperCaseAttributeViolation,
)
from wemake_python_styleguide.visitors.ast.naming import WrongNameVisitor


@pytest.mark.parametrize('wrong_name', [
'SOME',
'Value',
'nO',
'dATa',
])
def test_wrong_variable_name_case_insensitive(
assert_errors,
assert_error_text,
parse_ast_tree,
naming_template,
default_options,
mode,
wrong_name,
):
"""Ensures that wrong names are not allowed, case insensitive."""
tree = parse_ast_tree(mode(naming_template.format(wrong_name)))

visitor = WrongNameVisitor(default_options, tree=tree)
visitor.run()

assert_errors(
visitor,
[WrongVariableNameViolation],
ignored_types=UpperCaseAttributeViolation,
)
assert_error_text(visitor, wrong_name, multiple=True)

@pytest.mark.parametrize('wrong_name', [
'value',
'no',
Expand Down

0 comments on commit d2ac20e

Please sign in to comment.