From ee2952feaf60cf1bd7ae1dd11a02b4bbe1a97be6 Mon Sep 17 00:00:00 2001 From: Nataliia Date: Fri, 9 Sep 2022 13:07:08 +0300 Subject: [PATCH 1/2] fixed test --- tests/test_main.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index c747c461..bbd64adf 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,4 +1,5 @@ import pytest +import re from app.main import count_occurrences @@ -22,10 +23,10 @@ def test_count_occurrences(phrase, letter, count): 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'" + 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'" From 858ac8b62a02708cbad753b8eb72db41929d5925 Mon Sep 17 00:00:00 2001 From: Nataliia Zakharchuk <62181026+Nattalli@users.noreply.github.com> Date: Fri, 9 Sep 2022 13:13:38 +0300 Subject: [PATCH 2/2] Update test_main.py --- tests/test_main.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index bbd64adf..794a811c 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,5 +1,4 @@ import pytest -import re from app.main import count_occurrences @@ -26,7 +25,6 @@ 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'" + assert "# write your code here" not in file_content, \ + "You have to remove the unnecessary comment '# write your code here'" +