Skip to content

Commit 86d7718

Browse files
committed
1 parent 1011e34 commit 86d7718

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

exercises/13.4-Making_HTML_with_filter_and_maP/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# `13.4` Making HTML using filter function and map funtion
22

33
# 📝Instructions from your teacher:
4-
1. Fill the generate_li and filter_colors function to make the exercise print the following HTML with only the sexy colors:
4+
1. Create generate_li and filter_colors function to make the exercise print the following HTML with only the sexy colors:
55
```py
66
Expexted:
7-
<ul><li>Red</li><li>Orange</li><li>Pink</li><li>Violet</li></ul>
7+
<li>Red</li><li>Orange</li><li>Pink</li><li>Violet</li>
88
```
99

1010
# 💡Hint:

exercises/13.4-Making_HTML_with_filter_and_maP/test.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
import io
2-
import os
3-
import sys
4-
sys.stdout = buffer = io.StringIO()
5-
6-
import app
7-
import pytest
8-
1+
import io, sys, pytest, os, re
2+
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
93

104
@pytest.mark.it("Print the list of color in the console")
11-
def test_output():
12-
captured = buffer.getvalue()
13-
assert "\n" in captured
5+
def test_output(capsys, app):
6+
import app
7+
captured = capsys.readouterr()
8+
assert "<ul><li>Red</li><li>Orange</li><li>Pink</li><li>Violet</li></ul>\n" in captured
9+
10+
@pytest.mark.it("Create the function generate_li")
11+
def test_variable_exists(app):
12+
try:
13+
app.generate_li
14+
except AttributeError:
15+
raise AttributeError("The function 'generate_li' should exist on app.py")
16+
@pytest.mark.it("Create the function filter_colors")
17+
def test_function_exists(app):
18+
try:
19+
app.filter_colors
20+
except AttributeError:
21+
raise AttributeError("The function 'filter_colors' should exist on app.py")
1422

1523

1624
@pytest.mark.it("Use the filter function")

0 commit comments

Comments
 (0)