Skip to content

Commit

Permalink
Group one_line tests, edited start of README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterpieceElbow committed Jan 5, 2022
1 parent 4896162 commit f3ff20a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Linter formatter

- Read [the guideline](https://github.com/mate-academy/py-task-guideline/blob/main/README.md) before start

Линтер flake8 выдает такой отчет об ошибках при проверке каталога с файлами исходного
кода:
```python
Expand Down
28 changes: 11 additions & 17 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ def test_format_linter_error(error_linter, error_mate):
)


def test_format_linter_error_one_line():
code = inspect.getsource(format_linter_error)
@pytest.mark.parametrize(
"func",
[
format_linter_error,
format_single_linter_file,
format_linter_report,
],
)
def test_format_functions_one_line(func):
code = inspect.getsource(func)
assert (
isinstance(ast.parse(code).body[0].body[0], ast.Return) is True
), "Function 'format_linter_error' should contain only return statement"
), f"Function '{func.__name__}' should contain only return statement"


@pytest.mark.parametrize(
Expand Down Expand Up @@ -137,13 +145,6 @@ def test_format_single_linter_file(file_path, errors, result):
)


def test_format_single_linter_file_one_line():
code = inspect.getsource(format_single_linter_file)
assert (
isinstance(ast.parse(code).body[0].body[0], ast.Return) is True
), "Function 'format_single_linter_file' should contain only return statement"


@pytest.mark.parametrize(
"errors_linter,errors_mate",
[
Expand Down Expand Up @@ -342,10 +343,3 @@ def test_format_linter_report(errors_linter, errors_mate):
f"Function 'format_linter_report' should return {errors_mate} "
f"when 'errors' equals to {errors_linter}"
)


def test_format_linter_report_one_line():
code = inspect.getsource(format_linter_report)
assert (
isinstance(ast.parse(code).body[0].body[0], ast.Return) is True
), "Function 'format_linter_report' should contain only return statement"

0 comments on commit f3ff20a

Please sign in to comment.