Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python TypeError-update()为关键字参数';获取了多个值;名称';_Python - Fatal编程技术网

Python TypeError-update()为关键字参数';获取了多个值;名称';

Python TypeError-update()为关键字参数';获取了多个值;名称';,python,Python,我有一个方法 @automation def update(self, name, **kwargs): """ method body """ 装饰师: def auto_call(f): def new_fn(self, *args, **kwargs): """ method body """ 自动化测试用例: update(name, **kwargs) 这里name有一个值,**kwargs从预定义的字典中获取值 虽然我使用的是self,并按照预期

我有一个方法

@automation
def update(self, name, **kwargs):
"""
method body
"""
装饰师:

def auto_call(f):
    def new_fn(self, *args, **kwargs):
    """
    method body
    """
自动化测试用例:

update(name, **kwargs)
这里name有一个值,**kwargs从预定义的字典中获取值

虽然我使用的是self,并按照预期得到了下面的错误

TypeError: update() got multiple values for keyword argument 'name'

如果需要更改,请提供建议。

测试用例中的
kwargs
是否包含键
name
?测试中
kwargs
的值是多少?它有关键字“name”。我认为这就是它的冲突。我将更新中的关键字从名称更改为id。似乎已解决此问题。