|
1 | | -import io, sys, pytest, os, re, mock |
| 1 | +import io, sys, pytest, os, re, mock, app |
2 | 2 |
|
3 | 3 | @pytest.mark.it('The function swap_digits must exist') |
4 | | -def test_for_functon_existence(capsys, app): |
5 | | - assert callable(app.swap_digits) |
6 | | - |
7 | | -@pytest.mark.it('The function swap_digits must swap the digits of a 2 digits integer') |
8 | | -def test_for_file_output(capsys, app): |
9 | | - assert app.swap_digits(30) == str(30%10)+str(30//10) |
| 4 | +def test_function_exists(): |
| 5 | + assert app.swap_digits |
10 | 6 |
|
| 7 | +@pytest.mark.it('The function swap_digits must return something') |
| 8 | +def test_return_exists(): |
| 9 | + assert app.swap_digits(12) != None |
11 | 10 |
|
| 11 | +@pytest.mark.it('The function swap_digits should return an integer') |
| 12 | +def test_return_integer(): |
| 13 | + assert type(app.swap_digits(23)) == type(1) |
| 14 | + |
| 15 | +@pytest.mark.it('The function `swap_digits` must swap the digits. Testing with 79') |
| 16 | +def test_for_file_output(capsys, app): |
| 17 | + assert app.swap_digits(79) == 97 |
12 | 18 |
|
| 19 | +@pytest.mark.it('The function `swap_digits` must swap the digits. Testing with 30') |
| 20 | +def test_for_file_output_2(capsys, app): |
| 21 | + assert app.swap_digits(30) == 3 |
0 commit comments