Skip to content

Commit d427210

Browse files
authored
Merge pull request 4GeeksAcademy#1 from plucodev/master
Updated all the exercises
2 parents c696897 + c2576e3 commit d427210

File tree

19 files changed

+65
-67
lines changed

19 files changed

+65
-67
lines changed

.gitpod.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM gitpod/workspace-full:latest
22
USER gitpod
3-
RUN pip3 install pytest pytest-testdox mock && npm i [email protected] -g
3+
RUN pip3 install pytest==4.4.2 pytest-testdox mock && npm i [email protected] -g

exercises/02-Hello-World/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def test_output():
66
content = f.read()
77
assert content.find("print(") > 0
88

9-
@pytest.mark.it('The printed value on the console should be "red"')
9+
@pytest.mark.it('The printed value on the console should be "Hello World"')
1010
def test_for_file_output(capsys, app):
1111
app()
1212
captured = capsys.readouterr()
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
import io, sys, pytest, os, re, mock
22

33

4-
@pytest.mark.it("Create a function 'sum'")
5-
def test_declare_variable():
6-
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
7-
with open(path, 'r') as content_file:
8-
content = content_file.read()
9-
regex = re.compile(r"def(\s*)sum\(")
10-
assert bool(regex.search(content)) == True
11-
124
@pytest.mark.it('The function sum must exist')
135
def test_for_callable(capsys, app):
146
assert callable(app.sum)
@@ -21,10 +13,11 @@ def test_for_integer(capsys, app):
2113
def test_for_return(capsys, app):
2214
assert app.sum(3,4) == 7
2315

24-
@pytest.mark.it('The variable super_duper needs to be declared')
16+
@pytest.mark.it('You need to define the variable super_duper')
2517
def test_for_existence(capsys, app):
2618
app.super_duper
2719

2820
@pytest.mark.it('The variable super_duper needs to have as value the result of the sum of the two numbers')
2921
def test_for_file_output(capsys, app):
30-
assert app.super_duper == (3445324+53454423)
22+
assert app.super_duper == (3445324+53454423)
23+

exercises/04-Call-a-function/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `04` Calling a function
22

3-
A function could receive 0 no parameters, and you can it always returns something, event if you don't explicitly add the `return` statement.
3+
A function could receive 0 parameters, and you can it always returns something, event if you don't explicitly add the `return` statement.
44

55
:point_up: [Click here to read more about functions](https://content.breatheco.de/lesson/working-with-functions-python)
66

exercises/04-Call-a-function/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def test_for_square_area_value1(capsys, app):
3737

3838
@pytest.mark.it('square_area2 needs to have as value the area of the second square')
3939
def test_for_square_area_value2(capsys, app):
40-
assert app.square_area2 == 3
40+
assert app.square_area2 == 4
4141

4242
@pytest.mark.it('square_area3 needs to have as value the area of the third square')
4343
def test_for_square_area_value3(capsys, app):
4444
assert app.square_area3 == 25
4545

4646
@pytest.mark.it("Create a function calculate_area must be called 3 times, one for each figure")
47-
def test_declare_variable():
47+
def test_call_calculate_area():
4848
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
4949
with open(path, 'r') as content_file:
5050
content = content_file.read()

exercises/05-Defining-vs-Calling-a-function/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def test_declare_variable():
88
regex = re.compile(r"def(\s*)multi\(")
99
assert bool(regex.search(content)) == True
1010

11-
@pytest.mark.it('The function calculate_area must exist')
11+
@pytest.mark.it('The function multi must exist')
1212
def test_for_callable(capsys, app):
1313
assert callable(app.multi)
1414

exercises/06-lambda-functions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `06` Lambda functions in Python
22

3-
An lambda function is a function with just one line of code and no name.
3+
A lambda function is a function with just one line of code and no name.
44
It is a very special type of funcion in the world of python because you can use it as a small utility for very agile coding:
55

66
```python

exercises/06-lambda-functions/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import io, sys, pytest, os, re, mock
22

3-
@pytest.mark.it("Declar a function 'is_odd' as lambda")
3+
@pytest.mark.it("Declare a function 'is_odd' as lambda")
44
def test_declare_variable():
55
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
66
with open(path, 'r') as content_file:
@@ -13,7 +13,7 @@ def test_for_callable(capsys):
1313
import app as app
1414
assert callable(app.is_odd)
1515

16-
@pytest.mark.it('The function is_odd must receive one number and return true is odd or false otherwise')
16+
@pytest.mark.it('The function is_odd must receive one number and return true if is odd or false otherwise')
1717
def test_for_integer(capsys):
1818
import app as app
1919
assert app.is_odd(3) == True

exercises/07-lambda-function-two/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ print(multy(2,2))
1010

1111
# 📝 Instructions:
1212

13-
1. Create an lambda function called `rapid` it will take one string parameter
13+
1. Create a lambda function called `rapid` it will take one string parameter
1414
2. Return the same string but removing the last letter form it
1515

1616
# 💡 Hint
1717

18-
Google how to "remove las letter form string python" (you can use the square brackets)
18+
Google how to "remove last letter form string python" (you can use the square brackets)

exercises/07-lambda-function-two/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
# From this line above, plese do not change code below
5-
print(rapid("bob")) #should print JOH
5+
print(rapid("bob")) #should print bo

0 commit comments

Comments
 (0)