From fa077cae9ff7823cd91bc57ab5ef5b86b2d33fb9 Mon Sep 17 00:00:00 2001 From: iZafiro Date: Mon, 24 Feb 2020 12:27:04 -0300 Subject: [PATCH] Fix: Modify test_public_attrs_count tests to ignore class _ComplexityCounter. Issue #14 --- .../test_classes/test_public_attrs_count.py | 17 ++++++++++++++++- wemake_python_styleguide/options/defaults.py | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/test_visitors/test_ast/test_complexity/test_classes/test_public_attrs_count.py b/tests/test_visitors/test_ast/test_complexity/test_classes/test_public_attrs_count.py index da6a264be..49dab8c43 100644 --- a/tests/test_visitors/test_ast/test_complexity/test_classes/test_public_attrs_count.py +++ b/tests/test_visitors/test_ast/test_complexity/test_classes/test_public_attrs_count.py @@ -4,6 +4,12 @@ from wemake_python_styleguide.violations.complexity import ( TooManyPublicAttributesViolation, + TooManyExpressionsViolation, + TooManyReturnsViolation, + TooManyLocalsViolation, + TooManyArgumentsViolation, + TooManyAwaitsViolation, + TooManyRaisesViolation, ) from wemake_python_styleguide.visitors.ast.complexity.classes import ( ClassComplexityVisitor, @@ -95,7 +101,16 @@ def test_wrong_attributes_count( visitor = ClassComplexityVisitor(option_values, tree=tree) visitor.run() - assert_errors(visitor, [TooManyPublicAttributesViolation]) + assert_errors( + visitor, + [TooManyPublicAttributesViolation], + ignored_types = (TooManyExpressionsViolation, + TooManyReturnsViolation, + TooManyLocalsViolation, + TooManyArgumentsViolation, + TooManyAwaitsViolation, + TooManyRaisesViolation,), + ) assert_error_text(visitor, '2', option_values.max_attributes) diff --git a/wemake_python_styleguide/options/defaults.py b/wemake_python_styleguide/options/defaults.py index c01eb4fc2..be9ae1ea6 100644 --- a/wemake_python_styleguide/options/defaults.py +++ b/wemake_python_styleguide/options/defaults.py @@ -107,7 +107,7 @@ MAX_ACCESS_LEVEL: Final = 4 # guessed #: Maximum number of public attributes in a single class. -MAX_ATTRIBUTES: Final = 7 # guessed +MAX_ATTRIBUTES: Final = 6 # guessed #: Maximum number of raises in a function. MAX_RAISES: Final = 3 # guessed