新增一个python随机数函数,这样写调用不了

提问 5 258
公子wang
公子wang LV3 2023年11月22日 15:01 发表
<p><img src="http://talk-cdn.liumatest.cn/d736f6c2-bdf3-49bf-9c41-ede600389968.png" style="max-width:100%;"><br></p><p>随机数如果想区间可以应用的时候自己定义要怎么写</p>
收藏(0)  分享
相关标签: 提问 python
注意:本文归作者所有,未经作者允许,不得转载
5个回复
  • Chras-fu
    2023年11月23日 08:59
    不需要入参就把入参定义那行删除掉
    0 0
  • 公子wang
    2023年11月24日 16:35
    我在用例里面根本就用不了
    0 0
  • 公子wang
    2023年11月24日 16:38
    img[http://talk-cdn.liumatest.cn/1722161c-8752-4696-a3a1-8a612c041687.png]
    0 0
  • 公子wang
    2023年11月24日 16:39
    2023-11-24 08:38:53.670335 - Error - 'Generator' object has no attribute 'random_num' 2023-11-24 08:38:53.672165 - Error - 程序错误信息: Traceback (most recent call last): File "/liuma/core/api/testcase.py", line 71, in loop_execute self.render_content(step) File "/liuma/core/api/testcase.py", line 159, in render_content self.render_json(step, body, "body", pop_key) File "/liuma/core/api/testcase.py", line 178, in render_json render_value = self.template.render() File "/liuma/core/template.py", line 82, in render value = self.func_lib(name_args[0], *name_args[1:]) File "/liuma/tools/funclib/load_faker.py", line 24, in __call__ return getattr(self, name)(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/faker/proxy.py", line 105, in __getattr__ return getattr(self._factories[0], attr) AttributeError: 'Generator' object has no attribute 'random_num'
    0 1