cPyparsing_test.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:cpyparsing 作者: evhub 项目源码 文件源码
def makeTestSuite():
    import inspect
    suite = TestSuite()
    suite.addTest( PyparsingTestInit() )

    test_case_classes = ParseTestCase.__subclasses__()
    # put classes in order as they are listed in the source code
    test_case_classes.sort(key=lambda cls: inspect.getsourcelines(cls)[1])

    test_case_classes.remove(PyparsingTestInit)
    # test_case_classes.remove(ParseASMLTest)
    test_case_classes.remove(EnablePackratParsing)
    if IRON_PYTHON_ENV:
        test_case_classes.remove(OriginalTextForTest)

    suite.addTests(T() for T in test_case_classes)

    if TEST_USING_PACKRAT:
        # retest using packrat parsing (disable those tests that aren't compatible)
        suite.addTest( EnablePackratParsing() )

        unpackrattables = [ PyparsingTestInit, EnablePackratParsing, RepeaterTest, ]

        # add tests to test suite a second time, to run with packrat parsing
        # (leaving out those that we know wont work with packrat)
        packratTests = [t.__class__() for t in suite._tests
                            if t.__class__ not in unpackrattables]
        suite.addTests( packratTests )

    return suite
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号