|
4 | 4 | def test_for_functon_existence(capsys, app): |
5 | 5 | assert callable(app.swap_digits) |
6 | 6 |
|
7 | | -# @pytest.mark.it('The function swap_digits must return something') |
8 | | -# def test_for_functon_return_statement(capsys, app): |
9 | | -# path = os.path.dirname(os.path.abspath(__file__))+'/app.py' |
10 | | -# with open(path, 'r') as content_file: |
11 | | -# content = content_file.read() |
12 | | -# regex = re.compile(r"return(\s*)([^a-zA-Z0-9_])\w+") |
13 | | -# assert bool(regex.search(content)) == True |
| 7 | +@pytest.mark.it('The function swap_digits must return something') |
| 8 | +def test_for_functon_return_statement(capsys, app): |
| 9 | + path = os.path.dirname(os.path.abspath(__file__))+'/app.py' |
| 10 | + with open(path, 'r') as content_file: |
| 11 | + content = content_file.read() |
| 12 | + regex = re.compile(r"return(\s*)[^a-zA-Z0-9_]\w+") |
| 13 | + assert bool(regex.search(content)) == True |
14 | 14 |
|
15 | | - |
16 | | -@pytest.mark.it('The function swap_digits must swap the digits of a 2 digits integer') |
17 | | -def test_for_file_output(capsys, app): |
18 | | - result = str(30%10)+str(30//10) |
19 | | - assert app.swap_digits(30) == int(result) |
20 | 15 |
|
| 16 | +@pytest.mark.it('If `swap_digits` recieve 30 should return 3 as an integer') |
| 17 | +def test_for_file_output(capsys, app): |
| 18 | + assert app.swap_digits(30) == 3 |
21 | 19 |
|
22 | | -# @pytest.mark.it('The function swap_digits(30) shoud return 3 as an integer') |
23 | | -# def test_for_file_output(capsys, app): |
24 | | -# assert app.swap_digits(30) == 3 |
25 | | - |
| 20 | +@pytest.mark.it('The function `swap_digits` must swap the digits of a 2 digits integer') |
| 21 | +def test_for_file_output(capsys, app): |
| 22 | + assert app.swap_digits(79) == 97 |
26 | 23 |
|
27 | | -# @pytest.mark.it('The function swap_digits(30) shoud return 3 as an integer') |
28 | | -# def test_for_file_output(capsys, app): |
29 | | -# assert app.swap_digits(79) == 97 |
30 | 24 |
|
31 | 25 |
|
32 | | -# @pytest.mark.it('The function swap_digits(25) shoud return 52 as an integer') |
33 | | -# def test_for_file_output(capsys, app): |
34 | | -# assert app.swap_digits(35) == 53 |
35 | 26 |
|
36 | 27 |
|
0 commit comments