File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 11import pytest
2+ import inspect
23
3- from app .main import count_occurrences
4-
4+ from app import main
55
66@pytest .mark .parametrize (
77 "phrase,letter,count" ,
1515 ]
1616)
1717def test_count_occurrences (phrase , letter , count ):
18- assert count_occurrences (phrase , letter ) == count , (
18+ assert main . count_occurrences (phrase , letter ) == count , (
1919 f"Function 'count_occurrences' should return { count } , "
2020 f"when 'phrase'='{ phrase } ' and 'letter'='{ letter } '"
2121 )
2222
23-
24- def test_removed_comment ():
25- import app
26- with open (app .main .__file__ , "r" ) as f :
27- file_content = f .read ()
28- assert "# write your code here" not in file_content , \
29- "You have to remove the unnecessary comment '# write your code here'"
3023
24+ def test_removed_comment ():
25+ lines = inspect .getsource (main )
26+ assert "# write your code here" not in lines , ("You have to"
27+ " remove the unnecessary comment '# write your code here'" )
You can’t perform that action at this time.
0 commit comments