本文整理汇总了Python中Controller.Controller.do_off方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.do_off方法的具体用法?Python Controller.do_off怎么用?Python Controller.do_off使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller.Controller
的用法示例。
在下文中一共展示了Controller.do_off方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_NoOptionSelected
# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import do_off [as 别名]
def test_NoOptionSelected(self):
"""
This can be asserted by attempting to select a record
- Regardless if the attempt works or not, one expected outcome is that
no option will be selected
"""
theController = Controller(TestView.TestView(), None)
theController.do_select_rec("")
# For the method calls below, the main flow requires an option to be
# selected, therefore the alternative show message is expected
expectedMessage = "No option selected"
TestView.clearLog()
theController.do_on("")
theController.do_off("")
# 2 calls
self.assertEqual(2, len(TestView.theLog))
for actualMessage in TestView.theLog:
self.assertEqual(expectedMessage, actualMessage)
示例2: test_SelectedOption_TurnOnAndOff
# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import do_off [as 别名]
def test_SelectedOption_TurnOnAndOff(self):
"""
Options cannot be dynamically added to Controller
This test is based on the fact that Auto ID option exists
- Originally turned off
- Can be selected with argument "autoid"
- Its string descriptions are hard-coded, and ERP functionality states
what they must contain
"""
def getAutoIDStateMessage(expectOn):
state = "OFF"
if expectOn:
state = "ON"
return "Auto ID: TURNED {}\n. . .\nON: If an invalid or \
duplicate ID is specified when adding a record, that record is assigned an \
ID automatically (a blank ID is invalid)\nOFF: No automatic IDs will be used \
when adding records\n\n".format(state)
# Option will start off, then get turned on, then off again
expectedOff = getAutoIDStateMessage(False)
expectedOn = getAutoIDStateMessage(True)
theController = Controller(TestView.TestView(), None)
# Call 1, selecting the option. 3 show messages
expectedList = [TestObjectSelectionClass._expOptionHeader,
expectedOff,
TestObjectSelectionClass._expOptionFunctions]
TestView.clearLog()
theController.do_select_option("autoid")
self.assertEqual(expectedList, TestView.theLog)
# Call 2, turn off. 3 show messages
expectedList[1] = expectedOn
TestView.clearLog()
theController.do_on("")
self.assertEqual(expectedList, TestView.theLog)
# Call 3, turn on. 3 show messages
expectedList[1] = expectedOff
TestView.clearLog()
theController.do_off("")
self.assertEqual(expectedList, TestView.theLog)