Skip to content

Commit b6ceef4

Browse files
committed
Removed Random Petshop tests from abstract_factory.py as per #418
1 parent ffb45ca commit b6ceef4

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

lint.sh

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /bin/sh
1+
#! /bin/bash
22

33
pip install --upgrade pip
44
pip install black codespell flake8 isort mypy pytest pyupgrade tox

patterns/creational/abstract_factory.py

-25
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@ def buy_pet(self, name: str) -> Pet:
7777
return pet
7878

7979

80-
# Additional factories:
81-
82-
83-
# Create a random animal
84-
def random_animal(name: str) -> Pet:
85-
"""Let's be dynamic!"""
86-
return random.choice([Dog, Cat])(name)
87-
8880

8981
# Show pets with various factories
9082
def main() -> None:
@@ -95,27 +87,10 @@ def main() -> None:
9587
Here is your lovely Cat<Lucy>
9688
>>> pet.speak()
9789
meow
98-
99-
# A shop that sells random animals
100-
>>> shop = PetShop(random_animal)
101-
>>> for name in ["Max", "Jack", "Buddy"]:
102-
... pet = shop.buy_pet(name)
103-
... pet.speak()
104-
... print("=" * 20)
105-
Here is your lovely Cat<Max>
106-
meow
107-
====================
108-
Here is your lovely Dog<Jack>
109-
woof
110-
====================
111-
Here is your lovely Dog<Buddy>
112-
woof
113-
====================
11490
"""
11591

11692

11793
if __name__ == "__main__":
118-
random.seed(1234) # for deterministic doctest outputs
11994
shop = PetShop(random_animal)
12095
import doctest
12196

0 commit comments

Comments
 (0)