亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? unittest.py

?? mallet是自然語言處理、機器學習領域的一個開源項目。
?? PY
?? 第 1 頁 / 共 2 頁
字號:
#!/usr/bin/env python'''Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck'sSmalltalk testing framework.This module contains the core framework classes that form the basis ofspecific test cases and suites (TestCase, TestSuite etc.), and also atext-based utility class for running the tests and reporting the results (TextTestRunner).Simple usage:    import unittest    class IntegerArithmenticTestCase(unittest.TestCase):        def testAdd(self):  ## test method names begin 'test*'            self.assertEquals((1 + 2), 3)            self.assertEquals(0 + 1, 1)        def testMultiply(self):            self.assertEquals((0 * 10), 0)            self.assertEquals((5 * 8), 40)    if __name__ == '__main__':        unittest.main()Further information is available in the bundled documentation, and from  http://pyunit.sourceforge.net/Copyright (c) 1999, 2000, 2001 Steve PurcellThis module is free software, and you may redistribute it and/or modifyit under the same terms as Python itself, so long as this copyright messageand disclaimer are retained in their original form.IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OFTHIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCHDAMAGE.THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR APARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.'''__author__ = "Steve Purcell"__email__ = "stephen_purcell at yahoo dot com"__version__ = "#Revision: 1.43 $"[11:-2]import timeimport sysimport tracebackimport stringimport osimport types############################################################################### Test framework core##############################################################################class TestResult:    """Holder for test result information.    Test results are automatically managed by the TestCase and TestSuite    classes, and do not need to be explicitly manipulated by writers of tests.    Each instance holds the total number of tests run, and collections of    failures and errors that occurred among those test runs. The collections    contain tuples of (testcase, exceptioninfo), where exceptioninfo is the    formatted traceback of the error that occurred.    """    def __init__(self):        self.failures = []        self.errors = []        self.testsRun = 0        self.shouldStop = 0    def startTest(self, test):        "Called when the given test is about to be run"        self.testsRun = self.testsRun + 1    def stopTest(self, test):        "Called when the given test has been run"        pass    def addError(self, test, err):        """Called when an error has occurred. 'err' is a tuple of values as        returned by sys.exc_info().        """        self.errors.append((test, self._exc_info_to_string(err)))    def addFailure(self, test, err):        """Called when an error has occurred. 'err' is a tuple of values as        returned by sys.exc_info()."""        self.failures.append((test, self._exc_info_to_string(err)))    def addSuccess(self, test):        "Called when a test has completed successfully"        pass    def wasSuccessful(self):        "Tells whether or not this result was a success"        return len(self.failures) == len(self.errors) == 0    def stop(self):        "Indicates that the tests should be aborted"        self.shouldStop = 1    def _exc_info_to_string(self, err):        """Converts a sys.exc_info()-style tuple of values into a string."""        return string.join(apply(traceback.format_exception, err), '')    def __repr__(self):        return "<%s run=%i errors=%i failures=%i>" % \               (self.__class__, self.testsRun, len(self.errors),                len(self.failures))class TestCase:    """A class whose instances are single test cases.    By default, the test code itself should be placed in a method named    'runTest'.    If the fixture may be used for many test cases, create as    many test methods as are needed. When instantiating such a TestCase    subclass, specify in the constructor arguments the name of the test method    that the instance is to execute.    Test authors should subclass TestCase for their own tests. Construction    and deconstruction of the test's environment ('fixture') can be    implemented by overriding the 'setUp' and 'tearDown' methods respectively.    If it is necessary to override the __init__ method, the base class    __init__ method must always be called. It is important that subclasses    should not change the signature of their __init__ method, since instances    of the classes are instantiated automatically by parts of the framework    in order to be run.    """    # This attribute determines which exception will be raised when    # the instance's assertion methods fail; test methods raising this    # exception will be deemed to have 'failed' rather than 'errored'    failureException = AssertionError    def __init__(self, methodName='runTest'):        """Create an instance of the class that will use the named test           method when executed. Raises a ValueError if the instance does           not have a method with the specified name.        """        try:            self.__testMethodName = methodName            testMethod = getattr(self, methodName)            self.__testMethodDoc = testMethod.__doc__        except AttributeError:            raise ValueError, "no such test method in %s: %s" % \                  (self.__class__, methodName)    def setUp(self):        "Hook method for setting up the test fixture before exercising it."        pass    def tearDown(self):        "Hook method for deconstructing the test fixture after testing it."        pass    def countTestCases(self):        return 1    def defaultTestResult(self):        return TestResult()    def shortDescription(self):        """Returns a one-line description of the test, or None if no        description has been provided.        The default implementation of this method returns the first line of        the specified test method's docstring.        """        doc = self.__testMethodDoc        return doc and string.strip(string.split(doc, "\n")[0]) or None    def id(self):        return "%s.%s" % (self.__class__, self.__testMethodName)    def __str__(self):        return "%s (%s)" % (self.__testMethodName, self.__class__)    def __repr__(self):        return "<%s testMethod=%s>" % \               (self.__class__, self.__testMethodName)    def run(self, result=None):        return self(result)    def __call__(self, result=None):        if result is None: result = self.defaultTestResult()        result.startTest(self)        testMethod = getattr(self, self.__testMethodName)        try:            try:                self.setUp()            except KeyboardInterrupt:                raise            except:                result.addError(self, self.__exc_info())                return            ok = 0            try:                testMethod()                ok = 1            except self.failureException, e:                result.addFailure(self, self.__exc_info())            except KeyboardInterrupt:                raise            except:                result.addError(self, self.__exc_info())            try:                self.tearDown()            except KeyboardInterrupt:                raise            except:                result.addError(self, self.__exc_info())                ok = 0            if ok: result.addSuccess(self)        finally:            result.stopTest(self)    def debug(self):        """Run the test without collecting errors in a TestResult"""        self.setUp()        getattr(self, self.__testMethodName)()        self.tearDown()    def __exc_info(self):        """Return a version of sys.exc_info() with the traceback frame           minimised; usually the top level of the traceback frame is not           needed.        """        exctype, excvalue, tb = sys.exc_info()        if sys.platform[:4] == 'java': ## tracebacks look different in Jython            return (exctype, excvalue, tb)        newtb = tb.tb_next        if newtb is None:            return (exctype, excvalue, tb)        return (exctype, excvalue, newtb)    def fail(self, msg=None):        """Fail immediately, with the given message."""        raise self.failureException, msg    def failIf(self, expr, msg=None):        "Fail the test if the expression is true."        if expr: raise self.failureException, msg    def failUnless(self, expr, msg=None):        """Fail the test unless the expression is true."""        if not expr: raise self.failureException, msg    def failUnlessRaises(self, excClass, callableObj, *args, **kwargs):        """Fail unless an exception of class excClass is thrown           by callableObj when invoked with arguments args and keyword           arguments kwargs. If a different type of exception is           thrown, it will not be caught, and the test case will be           deemed to have suffered an error, exactly as for an           unexpected exception.        """        try:            apply(callableObj, args, kwargs)        except excClass:            return        else:            if hasattr(excClass,'__name__'): excName = excClass.__name__            else: excName = str(excClass)            raise self.failureException, excName    def failUnlessEqual(self, first, second, msg=None):        """Fail if the two objects are unequal as determined by the '!='           operator.        """        if first != second:            raise self.failureException, \                  (msg or '%s != %s' % (`first`, `second`))    def failIfEqual(self, first, second, msg=None):        """Fail if the two objects are equal as determined by the '=='           operator.        """        if first == second:            raise self.failureException, \                  (msg or '%s == %s' % (`first`, `second`))    assertEqual = assertEquals = failUnlessEqual    assertNotEqual = assertNotEquals = failIfEqual    assertRaises = failUnlessRaises    assert_ = failUnlessclass TestSuite:    """A test suite is a composite test consisting of a number of TestCases.    For use, create an instance of TestSuite, then add test case instances.    When all tests have been added, the suite can be passed to a test    runner, such as TextTestRunner. It will run the individual test cases    in the order in which they were added, aggregating the results. When    subclassing, do not forget to call the base class constructor.    """    def __init__(self, tests=()):        self._tests = []        self.addTests(tests)    def __repr__(self):        return "<%s tests=%s>" % (self.__class__, self._tests)    __str__ = __repr__    def countTestCases(self):        cases = 0        for test in self._tests:            cases = cases + test.countTestCases()        return cases    def addTest(self, test):        self._tests.append(test)    def addTests(self, tests):        for test in tests:            self.addTest(test)    def run(self, result):        return self(result)    def __call__(self, result):        for test in self._tests:            if result.shouldStop:                break            test(result)        return result    def debug(self):        """Run the tests without collecting errors in a TestResult"""        for test in self._tests: test.debug()class FunctionTestCase(TestCase):    """A test case that wraps a test function.    This is useful for slipping pre-existing test functions into the    PyUnit framework. Optionally, set-up and tidy-up functions can be    supplied. As with TestCase, the tidy-up ('tearDown') function will    always be called if the set-up ('setUp') function ran successfully.    """    def __init__(self, testFunc, setUp=None, tearDown=None,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜久久久久久电影| 蜜臀久久久99精品久久久久久| 成人教育av在线| 国产视频一区在线观看| 五月婷婷另类国产| 欧美丰满少妇xxxbbb| 五月天精品一区二区三区| 欧美日韩免费一区二区三区视频| 亚洲一卡二卡三卡四卡无卡久久| 欧美在线不卡视频| 舔着乳尖日韩一区| 在线观看日韩国产| 亚洲精品菠萝久久久久久久| 欧美自拍偷拍午夜视频| 亚洲第一主播视频| 91精品久久久久久久久99蜜臂| 日韩精品色哟哟| 精品国产一区二区三区不卡| 精品一区二区三区av| 国产午夜精品一区二区三区四区 | 久久欧美一区二区| 国产精品一区三区| 色婷婷综合久久久中文一区二区 | 久久久亚洲高清| 国产精品久久毛片av大全日韩| 成人av影视在线观看| 欧美三级韩国三级日本三斤| 久久一二三国产| 成人app在线观看| 中文字幕一区二区三区视频| 日本韩国欧美一区| 日韩精品欧美成人高清一区二区| 精品少妇一区二区三区视频免付费| 六月丁香婷婷久久| 国产亚洲综合av| 91黄色小视频| 免费久久99精品国产| 日本一区二区动态图| 成人av资源在线观看| 午夜视频久久久久久| 欧美tickling挠脚心丨vk| 丰满少妇在线播放bd日韩电影| 亚洲视频一区二区免费在线观看| 欧美三级欧美一级| 国产另类ts人妖一区二区| 亚洲欧美韩国综合色| 欧美在线三级电影| 亚洲欧洲精品一区二区精品久久久| 欧美日韩一卡二卡三卡| 极品少妇xxxx精品少妇偷拍| 亚洲免费视频成人| 精品国产制服丝袜高跟| 成人免费高清在线| 日韩激情一区二区| 国产精品久久久一本精品| 在线播放中文一区| 精品免费视频.| 99热国产精品| 午夜亚洲福利老司机| 国产喷白浆一区二区三区| 欧美偷拍一区二区| 国产成a人亚洲精| 亚洲h在线观看| 国产精品天干天干在线综合| 色综合天天综合网天天狠天天| 美女www一区二区| 亚洲美女免费在线| 久久你懂得1024| 欧美久久久久久久久久| 粉嫩av一区二区三区在线播放| 一区二区三区四区视频精品免费 | 在线精品视频免费播放| 国产乱子轮精品视频| 亚洲欧美日韩系列| 久久综合av免费| 国产精品自产自拍| 亚洲va国产va欧美va观看| 亚洲欧洲日产国产综合网| 日韩欧美你懂的| 在线免费观看日本欧美| 国产成人精品免费一区二区| 视频一区视频二区中文| 亚洲色图视频免费播放| 国产精品一区二区黑丝| 中文字幕精品综合| 欧美r级电影在线观看| 欧美视频一区二区| 成人精品免费看| 久久99精品网久久| 三级欧美韩日大片在线看| 成人免费在线视频观看| 国产日韩欧美不卡在线| 日韩丝袜情趣美女图片| 一本大道久久精品懂色aⅴ| 国产高清久久久| 久久99精品一区二区三区| 天天色综合成人网| 一区二区视频在线| 懂色av一区二区三区免费看| 欧美激情综合网| 精品国产第一区二区三区观看体验| 欧美日韩日本视频| 在线观看亚洲a| 成人自拍视频在线| 国产成人免费xxxxxxxx| 久久电影网电视剧免费观看| 国产女同互慰高潮91漫画| 日本一区二区免费在线| 亚洲国产成人午夜在线一区| 欧美韩日一区二区三区| 国产精品色婷婷久久58| 中文字幕日韩欧美一区二区三区| 国产精品久久久久精k8| 最新日韩在线视频| 亚洲免费观看高清在线观看| 欧美美女直播网站| 成人免费av网站| 99视频国产精品| 在线免费精品视频| 欧美丰满少妇xxxbbb| 欧美大尺度电影在线| 久久综合狠狠综合久久综合88| 国产欧美精品国产国产专区| 国产精品久久久久久久久久免费看 | 欧美性大战久久久久久久蜜臀 | 亚洲男帅同性gay1069| 亚洲欧美日韩在线播放| 亚洲444eee在线观看| 日本美女一区二区三区| 国内精品伊人久久久久影院对白| 国产一本一道久久香蕉| 成人国产免费视频| 色8久久精品久久久久久蜜 | 日韩一区二区电影网| 精品日韩一区二区三区免费视频| 色综合久久九月婷婷色综合| 欧美午夜一区二区三区| 欧美一区二区三区四区在线观看| 欧美xxxxxxxx| 国产视频一区二区三区在线观看| 日韩一区在线免费观看| 国产精品丝袜一区| 一区二区三区四区蜜桃| 蜜臀av性久久久久蜜臀aⅴ四虎| 久久综合综合久久综合| 成人深夜在线观看| 色av成人天堂桃色av| 色综合色综合色综合| 欧美日本免费一区二区三区| 日韩欧美亚洲国产精品字幕久久久| 国产情人综合久久777777| 一区二区三区自拍| 国产综合色视频| 99精品视频在线观看| 制服丝袜国产精品| 国产区在线观看成人精品 | 久久免费看少妇高潮| 亚洲人123区| 久久精品国产久精国产爱| 国产成都精品91一区二区三| 欧美三级三级三级| 久久精品视频在线看| 一区二区激情视频| 久久精品国产99久久6| 99精品视频一区二区| 欧美一级黄色大片| 亚洲欧洲国产日韩| 日本一区二区三区四区在线视频| 亚洲成人777| 国产91综合网| 欧美精品一二三四| 亚洲国产精品成人久久综合一区| 成人黄色777网| 国产精品69久久久久水密桃| 欧美日韩在线电影| 国产欧美日韩综合| 青椒成人免费视频| 99久久国产综合精品色伊| 亚洲成人av福利| 成人禁用看黄a在线| 日韩一区二区在线免费观看| 亚洲视频一区二区免费在线观看 | 日韩av在线发布| 91网站视频在线观看| 精品人伦一区二区色婷婷| 亚洲国产日韩av| 成人av在线电影| 精品粉嫩aⅴ一区二区三区四区| 一区二区三区四区视频精品免费 | 国产超碰在线一区| 欧美一区永久视频免费观看| 亚洲精品成人天堂一二三| 国产一区二区网址| 欧美一区二区在线视频| 亚洲人成亚洲人成在线观看图片| 国产在线一区二区综合免费视频| 欧美日韩国产综合一区二区| 中文字幕日韩一区| 亚洲综合清纯丝袜自拍| 丁香一区二区三区|