-
-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Restrict unicode names #267 * Restrict unicode names #267 review * Adds unicode violation, closes #267 * Removes unused fixture from noqa
- Loading branch information
Showing
9 changed files
with
123 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 0 additions & 162 deletions
162
tests/test_visitors/test_ast/test_naming/test_naming.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/test_visitors/test_ast/test_naming/test_naming_rules/test_unicode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import pytest | ||
|
||
from wemake_python_styleguide.violations.naming import UnicodeNameViolation | ||
from wemake_python_styleguide.visitors.ast.naming import WrongNameVisitor | ||
|
||
|
||
@pytest.mark.parametrize('wrong_name', [ | ||
'тестовое_имя', | ||
'test_имя', | ||
'сос', # written with identical to ASCII russian chars | ||
'some_變量', | ||
'имя2', | ||
]) | ||
def test_wrong_unicode( | ||
assert_errors, | ||
assert_error_text, | ||
parse_ast_tree, | ||
naming_template, | ||
default_options, | ||
mode, | ||
wrong_name, | ||
): | ||
"""Test names with unicode.""" | ||
tree = parse_ast_tree(mode(naming_template.format(wrong_name))) | ||
|
||
visitor = WrongNameVisitor(default_options, tree=tree) | ||
visitor.run() | ||
|
||
assert_errors(visitor, [UnicodeNameViolation]) | ||
assert_error_text(visitor, wrong_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.