Skip to content

Commit 5bda408

Browse files
Merge branch 'master' into master
2 parents 1d6c9ff + 9f6d1cf commit 5bda408

File tree

32 files changed

+122
-69
lines changed

32 files changed

+122
-69
lines changed

.github/workflows/learnpack-audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ jobs:
2525
uses: actions/setup-node@v2
2626
with:
2727
node-version: ${{ matrix.node-version }}
28-
- run: npm install learnpack -g
28+
- run: npm install @learnpack/learnpack@latest -g
2929
- run: learnpack audit

.gitpod.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ FROM gitpod/workspace-full:latest
33
USER gitpod
44

55
RUN pip3 install pytest==4.6.0 pytest-testdox mock
6-
RUN npm i @learnpack/learnpack -g && learnpack plugins:install learnpack-python@0.0.35
6+
RUN npm i @learnpack/learnpack@2.1.20 -g && learnpack plugins:install @learnpack/python@1.0.0

.gitpod.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ ports:
77

88
vscode:
99
extensions:
10-
- learnpack.learnpack-vscode
10+
- learn-pack.learnpack-vscode
11+
1112

1213
github:
1314
prebuilds:

exercises/02-Declare-Variables/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ def test_for_file_output(capsys):
2929
captured = buffer.getvalue()
3030
assert captured == "Yellow\n" #add \n because the console jumps the line on every print
3131

32+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_for_printing_variable():
1818

1919
with open(path, 'r') as content_file:
2020
content = content_file.read()
21-
regex = re.compile(r"print(\s*)\(\s*color\s*\)")
21+
regex = re.compile(r"print\s*\(\s*color\s*\)")
2222
assert bool(regex.search(content)) == True
2323

2424
@pytest.mark.it('The printed value on the console should be "red"')

exercises/04-Multiply-Two-Values/test.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ def test_use_variable_name():
2323
@pytest.mark.it('Print on the console the variables_are_cool value ')
2424
def test_for_file_output(capsys):
2525
captured = buffer.getvalue()
26-
assert captured == '17172435\n'
26+
assert captured == '17172435\n'
27+
28+
@pytest.mark.it('Print on the console the variables_are_cool variable')
29+
def test_for_print():
30+
with open(path, 'r') as content_file:
31+
content = content_file.read()
32+
# makes sure we are calling print function with a variable and not the hard coded value
33+
regex = re.compile(r"print\s*\(\s*variables_are_cool\s*\)")
34+
assert bool(regex.search(content)) == True

exercises/05-User-Inputed-Values/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ def test_for_file_output(capsys):
99
regex = re.compile(pattern)
1010
assert bool(regex.search(content)) == True
1111

12-
1312
@pytest.mark.it("We tried with age 50 and it was supposed to return 60")
1413
@mock.patch('builtins.input', lambda x: 50)
1514
def test_plus_ten(stdin):
@@ -18,3 +17,4 @@ def test_plus_ten(stdin):
1817
import app
1918
captured = buffer.getvalue()
2019
assert captured == "Your age is: 60\n"
20+

exercises/06-String-Concatenation/test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def test_my_var1_exists():
1010
except ImportError:
1111
raise ImportError("The variable 'my_var1' should exist on app.py")
1212

13-
1413
@pytest.mark.it("Create a variable named my_var2")
1514
def test_my_var2_exists():
1615
try:
@@ -24,10 +23,18 @@ def test_my_var1_value():
2423
assert my_var1 == "Hello"
2524

2625
@pytest.mark.it("Variable my_var2 value should be 'World'")
27-
def test_my_var1_value():
26+
def test_my_var2_value():
2827
from app import my_var2
2928
assert my_var2 == "World"
3029

30+
@pytest.mark.it("Variable my_var2 value should be 'World'")
31+
def test_the_new_string_exists():
32+
import app
33+
try:
34+
app.the_new_string
35+
except AttributeError:
36+
raise AttributeError('The variable "the_new_string" should exist on app.py')
37+
3138
@pytest.mark.it('Print "Hello World" on the console')
3239
def test_for_file_output():
3340
captured = buffer.getvalue()

exercises/07-Create-a-Basic-HTML/test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
sys.stdout = buffer = io.StringIO()
33
import app
44

5-
@pytest.mark.it('Use the function print()')
6-
def test_for_print():
7-
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
8-
with open(path, 'r') as content_file:
9-
content = content_file.read()
10-
regex = re.compile(r"print\s*\(.+\)")
11-
assert bool(regex.search(content)) == True
12-
135
@pytest.mark.it("Create a variable named html_document")
146
def test_html_document_exists():
157
try:
168
from app import html_document
179
except ImportError:
1810
raise ImportError("The variable 'html_document' should exist on app.py")
1911

12+
@pytest.mark.it("The value of html_document should be the expected")
13+
def test_html_document_exists():
14+
try:
15+
from app import html_document
16+
assert html_document == '<html><head><title></title></head><body></body></html>'
17+
except ImportError:
18+
raise ImportError("The variable 'html_document' should exist on app.py")
19+
2020
@pytest.mark.it('Concatenate all the variables together (in the right order) to set the value of html_document')
2121
def test_for_concat():
2222
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
@@ -30,4 +30,4 @@ def test_for_concat():
3030
@pytest.mark.it('Print a basic html layout on the console like this: <html><head><title></title></head><body></body></html>')
3131
def test_for_file_output():
3232
captured = buffer.getvalue()
33-
assert captured == "<html><head><title></title></head><body></body></html>\n" #add \n because the console jumps the line on every print
33+
assert captured == "<html><head><title></title></head><body></body></html>\n" #add \n because the console jumps the line on every print
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# `08` Your First If...
1+
# `08.1` Your First If...
22

33
La aplicación actual está preguntando cuánto dinero tiene el usuario. Una vez el usuario ingresa la cantidad, debemos 'imprimir' usando **print** una de las siguientes respuestas:
44

0 commit comments

Comments
 (0)