New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #1661: Add wemake profile #1662
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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,87 @@ | ||
"""A set of test cases for the wemake isort profile. | ||
|
||
Snippets are taken directly from the wemake-python-styleguide project here: | ||
https://github.com/wemake-services/wemake-python-styleguide | ||
""" | ||
from functools import partial | ||
|
||
from ..utils import isort_test | ||
|
||
wemake_isort_test = partial( | ||
isort_test, profile="wemake", known_first_party=["wemake_python_styleguide"] | ||
) | ||
|
||
|
||
def test_wemake_snippet_one(): | ||
wemake_isort_test( | ||
""" | ||
import ast | ||
import tokenize | ||
import traceback | ||
from typing import ClassVar, Iterator, Sequence, Type | ||
|
||
from flake8.options.manager import OptionManager | ||
from typing_extensions import final | ||
|
||
from wemake_python_styleguide import constants, types | ||
from wemake_python_styleguide import version as pkg_version | ||
from wemake_python_styleguide.options.config import Configuration | ||
from wemake_python_styleguide.options.validation import validate_options | ||
from wemake_python_styleguide.presets.types import file_tokens as tokens_preset | ||
from wemake_python_styleguide.presets.types import filename as filename_preset | ||
from wemake_python_styleguide.presets.types import tree as tree_preset | ||
from wemake_python_styleguide.transformations.ast_tree import transform | ||
from wemake_python_styleguide.violations import system | ||
from wemake_python_styleguide.visitors import base | ||
|
||
VisitorClass = Type[base.BaseVisitor] | ||
""" | ||
) | ||
|
||
|
||
def test_wemake_snippet_two(): | ||
wemake_isort_test( | ||
""" | ||
from collections import defaultdict | ||
from typing import ClassVar, DefaultDict, List | ||
|
||
from flake8.formatting.base import BaseFormatter | ||
from flake8.statistics import Statistics | ||
from flake8.style_guide import Violation | ||
from pygments import highlight | ||
from pygments.formatters import TerminalFormatter | ||
from pygments.lexers import PythonLexer | ||
from typing_extensions import Final | ||
|
||
from wemake_python_styleguide.version import pkg_version | ||
|
||
#: That url is generated and hosted by Sphinx. | ||
DOCS_URL_TEMPLATE: Final = ( | ||
'https://wemake-python-stylegui.de/en/{0}/pages/usage/violations/' | ||
) | ||
""" | ||
) | ||
|
||
|
||
def test_wemake_snippet_three(): | ||
wemake_isort_test( | ||
""" | ||
import ast | ||
|
||
from pep8ext_naming import NamingChecker | ||
from typing_extensions import final | ||
|
||
from wemake_python_styleguide.transformations.ast.bugfixes import ( | ||
fix_async_offset, | ||
fix_line_number, | ||
) | ||
from wemake_python_styleguide.transformations.ast.enhancements import ( | ||
set_if_chain, | ||
set_node_context, | ||
) | ||
|
||
|
||
@final | ||
class _ClassVisitor(ast.NodeVisitor): | ||
""" | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably
class _ClassVisitor(ast.NodeVisitor): ...