Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7991026

Browse files
Update test.py
1 parent e7b48b5 commit 7991026

File tree

1 file changed

+8
-11
lines changed
  • exercises/03-Print-Variables-In-The-Console

1 file changed

+8
-11
lines changed

‎exercises/03-Print-Variables-In-The-Console/test.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,20 @@
55
import pytest
66
import app
77
import os
8-
importre
8+
99
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
1010

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'")
1212
def test_declare_variable():
1313
result = app.color
1414
assert result == "red"
1515

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"
2320

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"')
2522
def test_for_file_output(capsys):
2623
captured = buffer.getvalue()
27-
assert "red\n" in captured
24+
assert "red marker\n" in captured

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /