test_javalist.py

来自「mallet是自然语言处理、机器学习领域的一个开源项目。」· Python 代码 · 共 53 行

PY
53
字号
from test_support import *from javatests import ListTestclass PyListTest(ListTest):          def __init__(self):       ListTest.__init__(self)          def newInstance(self, coll):       if coll is None:           return list()       else:           return list(coll)          def isReadOnly(self):       return False       class PyTupleTest(ListTest):          def __init__(self):       ListTest.__init__(self)          def newInstance(self, coll):       if coll is None:           return tuple()       else:           return tuple(coll)          def isReadOnly(self):       return True       # these first two tests just verify that we have a good unit testprint_test("ListTest.java driver (test_javalist.py)", 1)print_test("running test on ArrayList", 2)alt = ListTest.getArrayListTest(False)alt.testAll()print_test("running test on ArrayList (read-only)", 2)alt = ListTest.getArrayListTest(True)alt.testAll()# Now run the critical testsprint_test("running test on PyListTest", 2)       plt = PyListTest()plt.testAll()       print_test("running test on PyTupleTest", 2)       ptt = PyTupleTest()ptt.testAll()  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?