Skip to content

Commit

Permalink
Merge pull request mate-academy#178 from mate-academy/add-inspect
Browse files Browse the repository at this point in the history
added inspect
  • Loading branch information
Nattalli authored Nov 4, 2022
2 parents 32dc1dd + 874f08b commit 0e9649d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import inspect

import pytest

from app.main import count_occurrences
Expand All @@ -12,19 +14,17 @@
("Abracadabra", "A", 5),
("", "a", 0),
("Samsung", "b", 0),
]
],
)
def test_count_occurrences(phrase, letter, count):
assert count_occurrences(phrase, letter) == count, (
f"Function 'count_occurrences' should return {count}, "
f"when 'phrase'='{phrase}' and 'letter'='{letter}'"
)


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

def test_removed_comment():
lines = inspect.getsource(count_occurrences)
assert "# write your code here" not in lines, (
"You have to" " remove the unnecessary comment '# write your code here'"
)

0 comments on commit 0e9649d

Please sign in to comment.