|
5 | 5 | import pytest
|
6 | 6 | import app
|
7 | 7 | import os
|
8 | | -importre |
| 8 | + |
9 | 9 | path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
|
10 | 10 |
|
11 | | -@pytest.mark.it('Create a variable named "color" with the string value "red"') |
| 11 | +@pytest.mark.it("Create a variable named 'color' with the string value 'red'") |
12 | 12 | def test_declare_variable():
|
13 | 13 | result = app.color
|
14 | 14 | assert result == "red"
|
15 | 15 |
|
16 | | -@pytest.mark.it('Print on the console the value of the variable') |
17 | | -def test_for_printing_variable(): |
18 | | - |
19 | | - with open(path, 'r') as content_file: |
20 | | - content = content_file.read() |
21 | | - regex = re.compile(r"print\s*\(\s*color\s*\)") |
22 | | - assert bool(regex.search(content)) == True |
| 16 | +@pytest.mark.it("Create a variable named 'item' with the string value 'marker'") |
| 17 | +def test_declare_variable(): |
| 18 | + result = app.item |
| 19 | + assert result == "marker" |
23 | 20 |
|
24 | | -@pytest.mark.it('The printed value on the console should be "red"') |
| 21 | +@pytest.mark.it('The printed value on the console should be "red marker"') |
25 | 22 | def test_for_file_output(capsys):
|
26 | 23 | captured = buffer.getvalue()
|
27 | | - assert "red\n" in captured |
| 24 | + assert "red marker\n" in captured |
0 commit comments