Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
doctest (python) 中的模拟 Y (from X import Y)
我正在尝试创建一个带有模拟功能的文档测试 该功能位于单独的模块中 导入如下 from foomodule import foo def bar gt gt gt from minimock import mock gt gt gt mock
python
Testing
mocking
doctest
使用 doctest 并登录 python 程序
usr bin python2 4 import logging import sys import doctest def foo x gt gt gt foo 0 0 print d x logger debug d x def tes
python
logging
doctest
python 2 doctest 为何会失败,但失败消息中的值却没有差异?
我在 Windows 中使用 Python 2 7 9 我有一个 UTF 8 编码的 python 脚本文件 其中包含以下内容 coding utf 8 def test func u gt gt gt test func u return
python
Unicode
doctest
Python doctest:有条件地跳过测试
我知道如何使用跳过文档测试 doctest SKIP 但我不知道如何跳过测试有时 基于运行时条件 例如 gt gt gt if os path isfile foo open foo readlines else pass doctest
python
doctest
Python doctest:跳过整个块?
我有一个在类方法中包含文档字符串的 Python 模块 以及模块文档字符串中的一个真实示例 区别在于方法文档字符串经过精心设计 成为完全可重复的测试 而现实世界的示例只是 Linux shell 历史记录的复制粘贴 它碰巧调用了 pytho
python
doctest
在 Doctest 中使用 Mock?
我正在使用文档测试 我想知道对执行外部操作 例如发送电子邮件 连接到服务器等 的函数进行文档测试的正确方法是什么 使用 Mock 似乎是答案 但它会使函数的文档字符串变得混乱 例如 class SSHConnection BaseConne
python
Testing
mocking
python35
doctest
嵌套文档字符串的 Doctest
假设我有以下代码 def foo s A dummy function foo For example gt gt gt a This is a test string line 1 This is a test string line 2
python
doctest
docstring
python 2 / python 3 的便携式文档测试可能吗?
def fib r n memo 0 0 1 1 recursive fibonacci numbers generation with memoisation gt gt gt fib r n for n in range 10 0 1
python
doctest
Python:如何在文档测试中定义类?
我想使用 doctest 注释块来演示特定基类的用法 但这要么不能用 doctest 完成 要么我做错了什么 这是我的简单演示代码 class MyClass object gt gt gt m MyClass gt gt gt print
python
unittesting
class
doctest
使用 doctest 测试异常链接和回溯输出
如何使用 doctest 测试 多重回溯 看来要用几个ELLIPSIS and
python
doctest
配置 Django 以查找所有模块中的所有文档测试?
如果我运行以下命令 gt python manage py test Django 查看我的应用程序中的tests py 并运行该文件中的所有文档测试或单元测试 它还查看 test 字典以运行额外的测试 所以我可以从其他模块链接文档测试 如
django
doctest
djangotesting
Doctests:如何抑制/忽略输出?
以下 废话 Python 模块的 doctest 失败 gt gt gt L gt gt gt if True append to L XXX gt gt gt L 1 def append to L L append 1 class A
python
doctest
为什么 doctests 在使用 Sphinx 的 `make doctest` 运行时会引发 NameError?
我有一个简单的带有 doctest 的函数 http git io Tq2fTw 当与 Sphinx 一起运行时make doctest 给我以下错误 File scheemey rst line in default Failed exa
python
pythonsphinx
doctest
Doctest 无法识别 __future__.division
我写了以下文档测试x doctest This is something gt gt gt x 3 4 foo bar something else gt gt gt from future import division gt gt gt
python
Future
Division
doctest
包含字符串文字的文档测试
我有一个单元测试 我想为一个将 XML 作为字符串的函数编写 这是一个文档测试 我希望 XML 与测试一致 由于 XML 是多行的 我在文档测试中尝试了字符串文字 但没有成功 这是简化的测试代码 def test gt gt gt conf
python
comments
doctest
python24
使用 Pytest 运行文档测试和普通测试
在我的 Python 项目中 我使用 Pytest 目录结构为 src docs test 我有不同类型的测试 正常测试 在test 源代码中的文档测试 src 文档中的文档测试 docs rst 狮身人面像 我想一次运行所有这些 这样我就
python
Pytest
pythonsphinx
doctest
Python doctest 是否消除了单元测试的需要?
我所在项目的一位开发人员同事认为文档测试与单元测试一样好 并且如果一段代码经过文档测试 则不需要进行单元测试 我不相信情况是这样 任何人都可以提供一些可靠的 理想引用的例子来支持或反对文档测试取代单元测试需求的论点吗 谢谢 丹尼尔 编辑 任
python
unittesting
doctest
由于 unicode 导致 u 导致 Doctest 失败
我正在为一个输出标记化单词列表的函数编写文档测试 r gt gt gt s This is a tokenized sentence s u00f3 gt gt gt tokenizer tokenize s0 This is a toke
python
Unicode
portability
doctest
有没有办法只执行文档测试,忽略打印函数调用?
假设来说 我的功能返回一个值 and 有很多打印语句 也许 100 个或更多 有没有办法跑doctest这样所有其他打印工作都可以被忽略 跳过 我熟悉 SKIP指令 用于跳过doctest示例 即当我执行我的函数 或将我的模块作为脚本运行
python
python3x
Testing
doctest
python doctest:预期结果与“得到”结果相同,但测试失败
我正处于使用 python 作为软件 QA 工具的学习阶段 我编写了下一个简单的测试 以便在文本文件数字矩阵中找到字母 a 问题是测试失败 即使期望等于我得到的 这是为什么 你能告诉我我做错了什么吗 测试脚本 fin open abc tx
python
doctest