本文整理汇总了Python中module.Module.getState方法的典型用法代码示例。如果您正苦于以下问题:Python Module.getState方法的具体用法?Python Module.getState怎么用?Python Module.getState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module.Module
的用法示例。
在下文中一共展示了Module.getState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import getState [as 别名]
def main():
failcount = 0
print('Testing Module creation')
testmodule = Module('testmodule')
if( isinstance(testmodule, Module) ):
testresult = 'PASS'
else:
testresult = 'FAIL'
failcount += 1
print('Testmodule creation test: ' + testresult)
print('Testmod name: ' + testmodule.getName())
if( testmodule.getName() == 'testmodule'):
testresult = 'PASS'
else:
testresult = 'FAIL'
failcount += 1
print('Testmod name test: ' + testresult + '\n')
testmodstate = testmodule.getState()
print('Testmod initial state: ' + testmodstate)
if( testmodstate == 'INCOMPLETE'):
testresult = 'PASS'
else:
testresult = 'FAIL'
failcount += 1
print('Testmod initialize test: ' + testresult + '\n')
print('Testing change states')
print('Change to INCOMPLETE')
testmodule.changeStateIncomplete()
print('Testmod state: ' + testmodstate)
if(testmodule.getState() == 'INCOMPLETE'):
testresult = 'PASS'
else:
testresult = 'FAIL'
failcount += 1
print('Test: ' + testresult + '\n')
print('Change to COMPLETE')
testmodule.changeStateComplete()
print('Testmod state: ' + testmodstate)
if(testmodule.getState() == 'COMPLETE'):
testresult = 'PASS'
else:
testresult = 'FAIL'
failcount += 1
print('Test: ' + testresult + '\n')
print('Change to STRIKE')
testmodule.changeStateStrike()
print('Testmod state: ' + testmodstate)
if(testmodule.getState() == 'STRIKE'):
testresult = 'PASS'
else:
testresult = 'FAIL'
failcount += 1
print('Test: ' + testresult + '\n')
print('Change to INCOMPLETE')
testmodule.changeStateIncomplete()
print('Testmod state: ' + testmodstate)
if(testmodule.getState() == 'INCOMPLETE'):
testresult = 'PASS'
else:
testresult = 'FAIL'
failcount += 1
print('Test: ' + testresult + '\n')
print ("Tests finished running.")
print ("Tests failed: " + str(failcount))