-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
50 lines (31 loc) · 1.14 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from person.Person import Person
from student.Student import Student
from teacher.Teacher import Teacher
def testPerson():
johnInstance = Person('John', 36)
# Comprobar que no esté vacío
assert johnInstance != None
assert johnInstance.name == 'John'
assert johnInstance.age == 36
assert johnInstance.greet() == 'Hello my name is John'
assert johnInstance.getName() == 'John'
johnInstance.setName('Marta')
assert johnInstance.getName() == 'Marta'
assert johnInstance.getAge() == 36
dictMarta = johnInstance.__repr__()
assert dictMarta['name'] == 'Marta'
assert dictMarta['age'] == 36
dictMartaStr = johnInstance.__str__()
assert dictMartaStr == "{'name': 'Marta', 'age': 36}"
def testStudent():
studentInstance = Student('Noelia', 24)
assert studentInstance.greet() == 'Hello my name is Noelia'
def testTeacher():
teacherInstance = Teacher('Roger', 42, 0)
assert teacherInstance.getName() == 'Roger'
assert teacherInstance.getAge() == 42
assert teacherInstance.getPatience() == 0
if __name__ == '__main__':
testPerson()
testStudent()
testTeacher()