testcases/test07_personal_data.py:None (testcases/test07_personal_data.py) In wrapper: function uses no argument 'arg'
时间: 2023-07-15 07:12:05 浏览: 53
在这个测试用例中,测试函数没有使用 `arg` 参数,但是在 TestWrapper 中使用了 `arg` 来调用测试函数。你需要修改 TestWrapper 中的代码,使其不再传递 `arg` 参数。具体地说,可以将 `arg` 参数从 `runTest` 方法中移除,并将其余部分保持不变。修改后的代码如下所示:
```python
class TestWrapper(unittest.TestCase):
def __init__(self, test_func):
super().__init__()
self.test_func = test_func
def runTest(self):
self.test_func()
```
这样做的原因是 `arg` 参数在测试函数中没有被使用到,所以可以直接省略。
相关问题
程序报错:Traceback (most recent call last): File "/tmp/jqcore/jqboson/jqboson/core/entry.py", line 373, in _run engine.start() File "/tmp/jqcore/jqboson/jqboson/core/engine.py", line 231, in start self._dispatcher.start() File "/tmp/jqcore/jqboson/jqboson/core/dispatcher.py", line 273, in start self._run_loop() File "/tmp/jqcore/jqboson/jqboson/core/dispatcher.py", line 240, in _run_loop self._loop.run() File "/tmp/jqcore/jqboson/jqboson/core/loop/loop.py", line 105, in run self._handle_queue() File "/tmp/jqcore/jqboson/jqboson/core/loop/loop.py", line 151, in _handle_queue message.callback(**message.callback_data) File "/tmp/jqcore/jqboson/jqboson/core/mds/market_data_subscriber.py", line 228, in broadcast consumer.send(market_data) File "/tmp/jqcore/jqboson/jqboson/core/mds/market_data_consumer_manager.py", line 59, in consumer_gen msg_callback() File "/tmp/jqcore/jqboson/jqboson/core/mds/market_data_consumer_manager.py", line 52, in msg_callback callback(market_data) File "/tmp/jqcore/jqboson/jqboson/core/mds/market_data_consumer_manager.py", line 122, in wrapper result = callback(*args, **kwargs) File "/tmp/jqcore/jqboson/jqboson/core/strategy.py", line 407, in _wrapper self._context.current_dt File "/tmp/strategy/user_code.py", line 60, in handle_data mancd, hist = mancd(context) UnboundLocalError: local variable 'mancd' referenced before assignment
报错信息显示 `UnboundLocalError: local variable 'mancd' referenced before assignment`,这是因为 `mancd` 函数在计算过程中出现了错误,导致其没有返回结果,而在调用 `mancd` 函数时,`mancd` 没有被正确赋值,因此出现了该错误。
可以尝试检查 `mancd` 函数的计算过程,查看是否有语法错误或逻辑错误。另外,建议在 `mancd` 函数中加入一些调试信息,以便更好地定位问题。例如:
```python
def mancd(context):
# 获取股票价格数据
prices = history(g.period, '1d', 'close')[context.stock]
# 计算macd指标
macd, signal, hist = talib.MACD(prices)
# 计算mancd指标
mancd, signal, hist = talib.MACDEXT(prices, fastperiod=12, slowperiod=26, signalperiod=9)
print('mancd:', mancd)
# 返回计算结果
return mancd, hist
```
这样,在出现问题时,就可以通过查看日志,定位问题所在。
mkclass - processing the list of files /mnt/d/Test/c_file.cpp.hpj
It seems like you are running the `mkclass` command on the file `/mnt/d/Test/c_file.cpp.hpj`. `mkclass` is a command-line tool for generating C++ wrapper classes for COM interfaces. It is typically used to simplify COM programming in C++ by automatically generating the necessary C++ code to interact with COM objects.
The `.hpj` extension in your file name suggests that this file may be a Help Project file created using Microsoft Help Workshop. However, without more context it's difficult to say for sure.