本文整理汇总了Python中nose.plugins.doctests.Doctest.add_options方法的典型用法代码示例。如果您正苦于以下问题:Python Doctest.add_options方法的具体用法?Python Doctest.add_options怎么用?Python Doctest.add_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nose.plugins.doctests.Doctest
的用法示例。
在下文中一共展示了Doctest.add_options方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_options
# 需要导入模块: from nose.plugins.doctests import Doctest [as 别名]
# 或者: from nose.plugins.doctests.Doctest import add_options [as 别名]
def test_add_options(self):
# doctest plugin adds some options...
conf = Config()
opt = Bucket()
parser = MockOptParser()
plug = Doctest()
plug.add_options(parser, {})
o, d = parser.opts[0]
assert o[0] == '--with-doctest'
o2, d2 = parser.opts[1]
assert o2[0] == '--doctest-tests'
o3, d3 = parser.opts[2]
assert o3[0] == '--doctest-extension'
示例2: test_config
# 需要导入模块: from nose.plugins.doctests import Doctest [as 别名]
# 或者: from nose.plugins.doctests.Doctest import add_options [as 别名]
def test_config(self):
# test that configuration works properly when both environment
# and command line specify a doctest extension
parser = OptionParser()
env = {'NOSE_DOCTEST_EXTENSION':'ext'}
argv = ['--doctest-extension', 'txt']
dtp = Doctest()
dtp.add_options(parser, env)
options, args = parser.parse_args(argv)
print options
print args
self.assertEqual(options.doctestExtension, ['ext', 'txt'])
env = {}
parser = OptionParser()
dtp.add_options(parser, env)
options, args = parser.parse_args(argv)
print options
print args
self.assertEqual(options.doctestExtension, ['txt'])
示例3: test_config
# 需要导入模块: from nose.plugins.doctests import Doctest [as 别名]
# 或者: from nose.plugins.doctests.Doctest import add_options [as 别名]
def test_config(self):
# test that configuration works properly when both environment
# and command line specify a doctest extension
parser = OptionParser()
env = {"NOSE_DOCTEST_EXTENSION": "ext"}
argv = ["--doctest-extension", "txt"]
dtp = Doctest()
dtp.add_options(parser, env)
options, args = parser.parse_args(argv)
print(options)
print(args)
self.assertEqual(options.doctestExtension, ["ext", "txt"])
env = {}
parser = OptionParser()
dtp.add_options(parser, env)
options, args = parser.parse_args(argv)
print(options)
print(args)
self.assertEqual(options.doctestExtension, ["txt"])