本文整理匯總了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"])