Skip to content

Commit

Permalink
Merge pull request mate-academy#252 from mate-academy/add_test
Browse files Browse the repository at this point in the history
improved tests
  • Loading branch information
Nattalli authored Nov 4, 2022
2 parents e6e5e0f + ee3649d commit 088c990
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
import re
import ast
import inspect

from app import main
from app.main import (
format_linter_error,
format_single_linter_file,
Expand Down Expand Up @@ -346,22 +346,15 @@ def test_format_linter_report(errors_linter, errors_mate):
)


def test_removed_comment():
import app
with open(app.main.__file__, "r") as f:
file_content = f.read()
comment = re.compile("# write your code here")
assert not comment.search(
file_content
), "You have to remove the unnecessary comment '# write your code here'"
def test_comment_deleted():
lines = inspect.getsource(main)
assert "# write your code here" not in lines, (
"Remove the unnecessary" " comment '# write your code here'"
)


def test_double_quotes_instead_of_single():
import app
with open(app.main.__file__, "r") as f:
file_content = f.read()
comment = re.compile("\'")
assert not comment.search(
file_content
), "You have to use a double quotes \"\" instead of single \'\'"

lines = inspect.getsource(main)
assert "'" not in lines, (
'You have to use a double quotes "" instead' " of single ''"
)

0 comments on commit 088c990

Please sign in to comment.