當前位置: 首頁>>代碼示例>>Python>>正文


Python numpy.test方法代碼示例

本文整理匯總了Python中numpy.test方法的典型用法代碼示例。如果您正苦於以下問題:Python numpy.test方法的具體用法?Python numpy.test怎麽用?Python numpy.test使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在numpy的用法示例。


在下文中一共展示了numpy.test方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: runTests

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import test [as 別名]
def runTests(self):
        """Run Tests. Returns true on success, false on failure, and
        sets self.success to the same value.

        Because nose currently discards the test result object, but we need
        to return it to the user, override TestProgram.runTests to retain
        the result
        """
        if self.testRunner is None:
            self.testRunner = nose.core.TextTestRunner(stream=self.config.stream,
                                                       verbosity=self.config.verbosity,
                                                       config=self.config)
        plug_runner = self.config.plugins.prepareTestRunner(self.testRunner)
        if plug_runner is not None:
            self.testRunner = plug_runner
        self.result = self.testRunner.run(self.test)
        self.success = self.result.wasSuccessful()
        return self.success 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:20,代碼來源:noseclasses.py

示例2: __init__

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import test [as 別名]
def __init__(self, test, optionflags=0, setUp=None, tearDown=None,
                 checker=None, obj=None, result_var='_'):
        self._result_var = result_var
        self._nose_obj = obj
        doctest.DocTestCase.__init__(self, test,
                                     optionflags=optionflags,
                                     setUp=setUp, tearDown=tearDown,
                                     checker=checker) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:10,代碼來源:noseclasses.py

示例3: options

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import test [as 別名]
def options(self, parser, env=os.environ):
        Plugin.options(self, parser, env)
        # Test doctests in 'test' files / directories. Standard plugin default
        # is False
        self.doctest_tests = True
        # Variable name; if defined, doctest results stored in this variable in
        # the top-level namespace.  None is the standard default
        self.doctest_result_var = None 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:10,代碼來源:noseclasses.py

示例4: configure

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import test [as 別名]
def configure(self, options, config):
        # parent method sets enabled flag from command line --with-numpydoctest
        Plugin.configure(self, options, config)
        self.finder = self.test_finder_class()
        self.parser = doctest.DocTestParser()
        if self.enabled:
            # Pull standard doctest out of plugin list; there's no reason to run
            # both.  In practice the Unplugger plugin above would cover us when
            # run from a standard numpy.test() call; this is just in case
            # someone wants to run our plugin outside the numpy.test() machinery
            config.plugins.plugins = [p for p in config.plugins.plugins
                                      if p.name != 'doctest'] 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:14,代碼來源:noseclasses.py

示例5: loadTestsFromModule

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import test [as 別名]
def loadTestsFromModule(self, module):
        if not self.matches(module.__name__):
            npd.log.debug("Doctest doesn't want module %s", module)
            return
        try:
            tests = self.finder.find(module)
        except AttributeError:
            # nose allows module.__test__ = False; doctest does not and
            # throws AttributeError
            return
        if not tests:
            return
        tests.sort()
        module_file = src(module.__file__)
        for test in tests:
            if not test.examples:
                continue
            if not test.filename:
                test.filename = module_file
            # Set test namespace; test altered in place
            self.set_test_context(test)
            yield self.doctest_case_class(test,
                                          optionflags=self.doctest_optflags,
                                          checker=self.out_check_class(),
                                          result_var=self.doctest_result_var)

    # Add an afterContext method to nose.plugins.doctests.Doctest in order
    # to restore print options to the original state after each doctest 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:30,代碼來源:noseclasses.py


注:本文中的numpy.test方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。