本文整理匯總了Python中nose.plugins.doctests.Doctest.can_configure方法的典型用法代碼示例。如果您正苦於以下問題:Python Doctest.can_configure方法的具體用法?Python Doctest.can_configure怎麽用?Python Doctest.can_configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nose.plugins.doctests.Doctest
的用法示例。
在下文中一共展示了Doctest.can_configure方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_matches
# 需要導入模塊: from nose.plugins.doctests import Doctest [as 別名]
# 或者: from nose.plugins.doctests.Doctest import can_configure [as 別名]
def test_matches(self):
# doctest plugin wants tests from all NON-test modules
conf = Config()
opt = Bucket()
plug = Doctest()
plug.can_configure = True
plug.configure(opt, conf)
assert not plug.matches('test')
assert plug.matches('foo')
示例2: test_collect_txtfile
# 需要導入模塊: from nose.plugins.doctests import Doctest [as 別名]
# 或者: from nose.plugins.doctests.Doctest import can_configure [as 別名]
def test_collect_txtfile(self):
here = os.path.abspath(os.path.dirname(__file__))
support = os.path.join(here, 'support')
fn = os.path.join(support, 'foo', 'doctests.txt')
conf = Config()
opt = Bucket()
plug = Doctest()
plug.can_configure = True
plug.configure(opt, conf)
plug.extension = ['.txt']
suite = plug.loadTestsFromFile(fn)
for test in suite:
assert str(test).endswith('doctests.txt')
assert test.address(), "Test %s has no address"
示例3: test_collect_pymodule
# 需要導入模塊: from nose.plugins.doctests import Doctest [as 別名]
# 或者: from nose.plugins.doctests.Doctest import can_configure [as 別名]
def test_collect_pymodule(self):
here = os.path.dirname(__file__)
support = os.path.join(here, 'support')
if not support in sys.path:
sys.path.insert(0, support)
import foo.bar.buz
conf = Config()
opt = Bucket()
plug = Doctest()
plug.can_configure = True
plug.configure(opt, conf)
suite = plug.loadTestsFromModule(foo.bar.buz)
expect = ['[afunc (foo.bar.buz)]']
for test in suite:
self.assertEqual(str(test), expect.pop(0))
示例4: test_want_file
# 需要導入模塊: from nose.plugins.doctests import Doctest [as 別名]
# 或者: from nose.plugins.doctests.Doctest import can_configure [as 別名]
def test_want_file(self):
# doctest plugin can select module and/or non-module files
conf = Config()
opt = Bucket()
plug = Doctest()
plug.can_configure = True
plug.configure(opt, conf)
assert plug.wantFile('foo.py')
assert not plug.wantFile('bar.txt')
assert not plug.wantFile('buz.rst')
assert not plug.wantFile('bing.mov')
plug.extension = ['.txt', '.rst']
assert plug.wantFile('/path/to/foo.py')
assert plug.wantFile('/path/to/bar.txt')
assert plug.wantFile('/path/to/buz.rst')
assert not plug.wantFile('/path/to/bing.mov')