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
示例#2
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
示例#3
0
 def get_furniture(furniture_type):
     try:
         if furniture_type in {"BigChair", "MediumChair", "SmallChair"}:
             return ChairFactory.get_chair(furniture_type)
         elif furniture_type in {"BigTable", "MediumTable", "SmallTable"}:
             return TableFactory.get_table(furniture_type)
         else:
             raise AssertionError("Furniture not found")
     except AssertionError as _e:
         print(_e)
     return None
示例#4
0
    def get_furniture(furniture_type):
        try:

            if furniture_type in ["BigChair","MediumChair","SmallChair"]:
                return ChairFactory.get_chair(furniture_type)
            if furniture_type in ["SmallTable","MediumTable","BigTable"]:
                return TableFactory.get_Table(furniture_type)

            raise AssertionError("Cannot find furniture type")

        except AssertionError as _e:
            print(_e)
        return None
示例#5
0
"Factory Use Case Example Code"

from chair_factory import ChairFactory

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