为人类制作的蟒蛇模型
prophep的Python项目详细描述
预言
为人类制作的Python模型。 深受伟大的php的Prophecy启发。
用法
fromexamples.calculatorimportCalculatorfromexamples.displayerimportDisplayerfromprophepyimportprophesizecalculator=prophesize(Calculator)displayer=Displayer(calculator._reveal())calculator.add(2,3)._should_be_called()calculator.add(2,3)._will_return(5)displayer.display_add(2,3)calculator.check_prophecies()
安装
pip install prophepy
测试
python -m unittest tests/test.py