【发布时间】:2019-09-23 05:25:59
【问题描述】:
以下代码工作正常,这是一个模拟打印功能的非常简单的测试。问题是当我调用 mocked_print 并希望使用 assert_call_once_with 方法自动完成 mocked_print 时,编辑器的建议中不会出现。
Here's an image of the suggestions I get
环境:
- Windows 10
- PyCharm 社区版 2019.2.2
- python 3.7.4.exe
import unittest
from unittest import mock
def print_something():
print('Hello')
class TestFoo(unittest.TestCase):
def test_print(self):
with mock.patch('builtins.print') as mocked_print:
print_something()
mocked_print.assert_called_once_with("Hello")
【问题讨论】:
标签: python autocomplete mocking pycharm