-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapacitor.py
More file actions
58 lines (41 loc) · 1.54 KB
/
capacitor.py
File metadata and controls
58 lines (41 loc) · 1.54 KB
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
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
from ex1 import HealingCreatureFactory, TransformCreatureFactory
def test_healing_factory(factory: HealingCreatureFactory) -> None:
"""Test the healing creature factory."""
print("Testing Creature with healing capability")
print(" base:")
healing_base = factory.create_base()
print(healing_base.describe())
print(healing_base.attack())
print(healing_base.heal("itself"))
print(" evolved:")
healing_evolved = factory.create_evolved()
print(healing_evolved.describe())
print(healing_evolved.attack())
print(healing_evolved.heal("itself and others"))
def test_transform_factory(factory: TransformCreatureFactory) -> None:
"""Test the transform creature factory."""
print("Testing Creature with transform capability")
print(" base:")
transform_base = factory.create_base()
print(transform_base.describe())
print(transform_base.attack())
print(transform_base.transform())
print(transform_base.attack())
print(transform_base.revert())
print(" evolved:")
transform_evolved = factory.create_evolved()
print(transform_evolved.describe())
print(transform_evolved.attack())
print(transform_evolved.transform())
print(transform_evolved.attack())
print(transform_evolved.revert())
def main() -> None:
"""Run the test scenario."""
healing = HealingCreatureFactory()
transform = TransformCreatureFactory()
test_healing_factory(healing)
print()
test_transform_factory(transform)
if __name__ == "__main__":
main()