Exemplo n.º 1
0
 def get_furniture(furniture):
     "Static get_factory method"
     try:
         if furniture in ['SmallChair', 'MediumChair', 'BigChair']:
             return ChairFactory().get_chair(furniture)
         if furniture in ['SmallTable', 'MediumTable', 'BigTable']:
             return TableFactory().get_table(furniture)
         raise Exception('No Factory Found')
     except Exception as _e:
         print(_e)
     return None
 def get_furniture(furniture):
     """Static get_furniture method"""
     try:
         if furniture in ["SmallChair", "MediumChair", "BigChair"]:
             return ChairFactory().get_chair(furniture)
         if furniture in ["SmallTable", "MediumTable", "BigTable"]:
             return TableFactory().get_table(furniture)
         raise AssertionError("No Furniture Factory Found")
     except AssertionError as _e:
         print(_e)
     return None
Exemplo n.º 3
0
"Factory Use Case Example Code"

from chair_factory import ChairFactory

# The Client
CHAIR = ChairFactory().get_chair("SmallChair")
print(CHAIR.get_dimensions())