def str2Money(s, factory_type): amount, currency = s.split(" ") factory = MoneyFactory(int(factory_type)) money = None if currency == "USD": money = factory.dollar(amount) elif currency == "CHF": money = factory.franc(amount) elif currency == "CNY": money = factory.yuan(amount) else: raise Exception( currency + " not in testcase") return money
def str2Money(s, factory_type): amount, currency = s.split(" ") factory = MoneyFactory(int(factory_type)) money = None if currency == "USD": money = factory.dollar(amount) elif currency == "CHF": money = factory.franc(amount) elif currency == "CNY": money = factory.yuan(amount) else: raise Exception(currency + " not in testcase") return money