我发现是模拟方法的一种更简洁的方法。但是,当我运行pytest,我得到
orig_width,orig_height = image_reader.getSize() ValueError:没有足够的值解包(预期2,got 0)
我是test_tdd.py
def test_get_image_x1(mocker):
"""Test half size image."""
# This works but it is longer
class Mock_class:
def __init__(sel
Python中的TDD是否有特定的目录结构?
教程讨论测试的内容,但不讨论将它们放在哪里。
在Python的周围闲逛,怀疑它是这样的:
/project/main_program.py # This has main method, starts program
/project/classes/<many classes>.py
/project/main_test.py # This simply directs unittest onto tests, can use parameters fed to it to customise t
我准备用python和libtcod roguelike游戏库做一个游戏。
更重要的是,我之所以使用PyMock,是因为我刚刚开始学习测试驱动开发,并且我决心不作弊。我真的很想养成这样做的习惯,根据TDD的说法,在我写第一行代码之前,我需要一个失败的单元测试。
我认为我对我的“生产”代码的第一个测试应该是它的依赖项libcotdpy被导入。
我的测试文件:
#!/usr/bin/python
import pymock # for mocking and unit testing
import game # my (empty) production code file, game
我正在尝试获取每个专利号对应的发布日期。
这是Excel表格:
数据库为espacenet.com
下面是您在Excel表格中看到的第一个专利的链接:
在"Publication“标题下,我需要在将专利号与Excel表格中的专利号进行匹配后获取日期。
代码如下:
Sub tryextraction()
Dim ie As New InternetExplorer
Dim sdd As String
Dim tdd() As String
Dim num0 As Integer
Dim num1 As Integer
Dim doc As HTMLDocument
Dim