本文整理匯總了Python中DBManager.DBManager.setSessionPeriod方法的典型用法代碼示例。如果您正苦於以下問題:Python DBManager.setSessionPeriod方法的具體用法?Python DBManager.setSessionPeriod怎麽用?Python DBManager.setSessionPeriod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.setSessionPeriod方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TESTS
# 需要導入模塊: from DBManager import DBManager [as 別名]
# 或者: from DBManager.DBManager import setSessionPeriod [as 別名]
print "(=) Testing Failure of createSession function"
try:
db.createSession(ses)
print "\t(-) Failure of createSession Test Failed"
except SessionError as se:
print "\t(+) Failure of createSession Test Passed. Error Caught:", se.msg
#---------------------------------------------------------------------------------------------------------#
print "(=) Testing Failure of getSession function"
try:
db.getSession('invalidphrase')
print "\t(-) Failure of getSession Test Failed"
except SessionError as se:
print "\t(+) Failure of getSession Test Passed. Error Caught:", se.msg
#---------------------------------------------------------------------------------------------------------#
print "(=) Setting period of %s to 1 day." % ses
db.setSessionPeriod(ses, 1)
#---------------------------------------------------------------------------------------------------------#
print "(=) Testing Failure of setSessionPeriod function"
try:
db.setSessionPeriod(ses, 'invalid duration')
print "\t(-) Failure of setSessionPeriod Test Failed"
except ValueError as ve:
print "\t(+) Failure of setSessionPeriod Test Passed. Error Caught:", ve
#---------------------------------------------------------------------------------------------------------#
print "(=) Testing getSessions function"
print "(=) List of all sessions"
db.printSessions()
#---------------------------------------------------------------------------------------------------------#
#---------------------------------------------------------------------------------------------------------#
print "(========)NODE FUNCTION TESTS(========)"
#---------------------------------------------------------------------------------------------------------#