为隐式从参数文件中获取选项的函数编写一个很好的测试

时间:2017-03-23 11:23:37

标签: python python-unittest

我原则上有一个看起来像这样的功能:

def myfunction(parameter):
    methodx = config['methodx']

    if methodx == 'method_a':
        something = apply_methoda_to_parameter
    if methodx == 'method_b':
        something = apply_methodb_to_parameter
    return something

config['methodx']来自外部配置文件。 编写涵盖method_amethod_b个案的测试函数最好的方法是什么? 我是否必须使用methodx关键字对其进行测试?

0 个答案:

没有答案