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 5a2a0a4

Browse files
committed
04.1-count_on
1 parent 9a434a8 commit 5a2a0a4

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed
-4.25 KB
Binary file not shown.

‎exercises/04.1-count_on/test.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import io, sys, os, pytest, re
1+
import io, sys, os, pytest, re, app
22
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
33

4+
@pytest.mark.it("The variable 'new_list' should exist")
5+
def test_variable_exists():
6+
assert app.new_list != None
47

5-
@pytest.mark.it("The variable `hello` should exist")
6-
def test_for_loop():
7-
with open(path, 'r') as content_file:
8-
content = content_file.read()
9-
regex = re.compile(r"hello")
10-
assert bool(regex.search(content)) == True
8+
@pytest.mark.it("The variable 'new_list' value should contain data-types of 'dict' and 'list'")
9+
def test_variable_value():
10+
assert app.new_list == [[2, 1], {'name': 'juan'}]
1111

1212

1313
@pytest.mark.it("You have to use a for loop")
@@ -24,8 +24,15 @@ def test_if():
2424
regex = re.compile(r"if(\s)")
2525
assert bool(regex.search(content)) == True
2626

27-
@pytest.mark.it("You have to print the value of the variable 'hello' in the console")
28-
def test_all_data_type(capsys, app):
29-
app()
30-
captured = capsys.readouterr()
31-
assert "[[2, 1], {'name': 'juan'}]\n" in captured.out
27+
# @pytest.mark.it("You have to print the value of the variable 'hello' in the console")
28+
# def test_all_data_type(capsys, app):
29+
# app()
30+
# captured = capsys.readouterr()
31+
# assert "[[2, 1], {'name': 'juan'}]\n" in captured.out
32+
33+
@pytest.mark.it("Print the value of the variable 'new_list'")
34+
def test_if():
35+
with open(path, 'r') as content_file:
36+
content = content_file.read()
37+
regex = re.compile(r"print\(new_list\)")
38+
assert bool(regex.search(content)) == True

0 commit comments

Comments
(0)

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