@@ -14,7 +14,7 @@ def test_only_change_line_5():
1414 path = os .path .dirname (os .path .abspath (__file__ ))+ '/app.py'
1515 with open (path , 'r' ) as content_file :
1616 content = content_file .read ()
17- line = r"print( \s*)\( get_randomInt( \s*)\(( \s*)\)( \s*) \)"
17+ line = r"print\s*\(\s* get_randomInt\s*\( \s*\) \s*\)"
1818 regex = re .compile (line )
1919 assert bool (regex .search (content )) == True
2020
@@ -26,18 +26,18 @@ def test_function_exists():
2626 raise AttributeError ('The function "get_randomInt" should return only values from 1 through 10 inclusive' )
2727
2828@pytest .mark .it ("get_randomInt function should return a random integer between 1 and 10" )
29- def test_function_exists ():
29+ def test_function_exists1 ():
3030 try :
31- for i in range (100 ):
32- if app . get_randomInt () < 1 or app . get_randomInt () > 10 :
33- # only asserting if value is outside the range, else it will pass
34- assert app . get_randomInt () < 1 or app . get_randomInt () > 10
31+ for i in range (10 ):
32+ # only asserting if value is outside the range, else it will pass
33+ result = app . get_randomInt ()
34+ assert result > 1 and result < 10
3535 except AttributeError :
3636 raise AttributeError ('The function "get_randomInt" is returning values outside the specified range' )
3737
3838@pytest .mark .it ("get_randomInt function should NOT be returning a static integer value" )
3939# in case user returns single value between [1 and 10]
40- def test_function_exists ():
40+ def test_function_exists2 ():
4141 try :
4242 tries = 0
4343 output = app .get_randomInt ()
0 commit comments