File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1+ import inspect
2+
13import pytest
24
35from app .main import count_occurrences
1214 ("Abracadabra" , "A" , 5 ),
1315 ("" , "a" , 0 ),
1416 ("Samsung" , "b" , 0 ),
15- ]
17+ ],
1618)
1719def test_count_occurrences (phrase , letter , count ):
1820 assert count_occurrences (phrase , letter ) == count , (
1921 f"Function 'count_occurrences' should return { count } , "
2022 f"when 'phrase'='{ phrase } ' and 'letter'='{ letter } '"
2123 )
2224
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'"
3025
26+ def test_removed_comment ():
27+ lines = inspect .getsource (count_occurrences )
28+ assert "# write your code here" not in lines , (
29+ "You have to" " remove the unnecessary comment '# write your code here'"
30+ )
You can’t perform that action at this time.
0 commit comments