Skip to content

Commit 4f68900

Browse files
committed
chore(py-workbook): improove solution and test exe-001
1 parent bf73be6 commit 4f68900

File tree

3 files changed

+24
-28
lines changed

3 files changed

+24
-28
lines changed
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
2-
# Simple ADDRESS PRINTING program.
3-
4-
def print_address(address):
1+
# Solution Python Workbook Exercise 001: Print Address
2+
3+
def print_address(address: str):
4+
"""
5+
Thi function take a string address and returns it.
6+
:param address: a string containing the address
7+
:return: a string with the address, that can be eventually formatted
8+
"""
59
return address
610

711

8-
print(print_address("ATTENE ALESSANDRO\nVia della Speranza, 13\n20019 - Milano (MI)"))
12+
if __name__ == "__main__":
13+
sample_address = "ATTENE ALESSANDRO\nVia della Speranza, 13\n20019 - Milano (MI)"
14+
print(print_address(sample_address))
15+

learning/python-workbook/chap_01/exe_001_print_address_tes.py

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from exe_001_print_address import print_address
2+
3+
4+
def test_exe_001():
5+
""" To start the tests, type from CLI: pytest """
6+
name: str = 'ATTENE ALESSANDRO'
7+
address: str = 'Via della Speranza, 13'
8+
cap: int= 20019
9+
city: str = 'Milano (MI)'
10+
complete_address: str = f"{name}\n{address}\n{cap} - {city}"
11+
result_address: str = print_address(complete_address)
12+
assert result_address == complete_address

0 commit comments

Comments
 (0)