Exemple #1
0
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
Exemple #2
0
def step(context, factory_type):
    factory = MoneyFactory(int(factory_type))
    context.response = {}
    context.response['ft'] = factory_type
    context.response['factory'] = factory