Skip to content

Commit 389f07d

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
1 parent 9bbfa8c commit 389f07d

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

tests/test_visitors/test_ast/test_conditions/test_simplified_match_with_sequence_or_mapping.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ def test_simplifiable_sequence_or_mapping_match(
135135
):
136136
"""Test that simple sequence and mapping matches raise a violation."""
137137
tree = parse_ast_tree(code)
138-
visitor = SimplifiableMatchWithSequenceOrMappingVisitor(default_options, tree=tree)
138+
visitor = SimplifiableMatchWithSequenceOrMappingVisitor(
139+
default_options, tree=tree
140+
)
139141
visitor.run()
140142
assert_errors(visitor, [SimplifiableMatchWithSequenceOrMappingViolation])
141143

@@ -160,6 +162,8 @@ def test_not_simplifiable_sequence_or_mapping_match(
160162
):
161163
"""Test that complex or non-simplifiable matches do not raise violations."""
162164
tree = parse_ast_tree(template)
163-
visitor = SimplifiableMatchWithSequenceOrMappingVisitor(default_options, tree=tree)
165+
visitor = SimplifiableMatchWithSequenceOrMappingVisitor(
166+
default_options, tree=tree
167+
)
164168
visitor.run()
165-
assert_errors(visitor, [])
169+
assert_errors(visitor, [])

wemake_python_styleguide/logic/tree/pattern_matching.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _is_simple_pattern_element(pattern: ast.pattern) -> bool:
180180
# If pattern.name is not None, it's a binding (not simple)
181181
if pattern.name is not None:
182182
return False
183-
# If pattern.name is None but pattern.pattern is not None,
183+
# If pattern.name is None but pattern.pattern is not None,
184184
# check if the inner pattern is simple
185185
if pattern.pattern is not None:
186186
return _is_simple_pattern_element(pattern.pattern)

wemake_python_styleguide/visitors/ast/conditions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ def _check_simplifiable_match_seq_or_map(self, node: ast.Match) -> None:
245245
)
246246
and first.guard is None # No guard clause
247247
):
248-
self.add_violation(consistency.SimplifiableMatchWithSequenceOrMappingViolation(node))
248+
self.add_violation(
249+
consistency.SimplifiableMatchWithSequenceOrMappingViolation(
250+
node
251+
)
252+
)
249253

250254

251255
@final

0 commit comments

Comments
 (0)