本文整理匯總了Python中machine.Machine.repair方法的典型用法代碼示例。如果您正苦於以下問題:Python Machine.repair方法的具體用法?Python Machine.repair怎麽用?Python Machine.repair使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類machine.Machine
的用法示例。
在下文中一共展示了Machine.repair方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestMachine
# 需要導入模塊: from machine import Machine [as 別名]
# 或者: from machine.Machine import repair [as 別名]
class TestMachine(unittest.TestCase):
def setUp(self):
Machine.available = []
self.machine = Machine(1, 'Janome', ['overlock', 'zig-zag', 'costura reta'])
def test_startup_machine(self):
self.machine.code |should| equal_to(1)
self.machine.producer |should| equal_to('Janome')
self.machine.sewing_types |should| equal_to(['overlock', 'zig-zag', 'costura reta'])
self.machine.repairing |should| equal_to(False)
self.machine.repairs |should| equal_to([])
Machine.available |should| equal_to([self.machine])
def test_repair_machine(self):
self.machine.repair('supervisor', '16-10-2012')
self.machine.repairing |should| equal_to(True)
self.machine.repairs |should| equal_to([{'supervisor': 'supervisor', 'initiate': '16-10-2012'}])
Machine.available |should_not| contain(self.machine)
(self.machine.repair, 'supervisor2', '17-10-2012') |should| throw(MachineInRepair)
def test_finish_repair_machine(self):
self.machine.repair('supervisor', '16-10-2012')
self.machine.finish_repair('17-10-2012')
self.machine.repairs |should| equal_to([{'supervisor': 'supervisor', 'initiate': '16-10-2012', 'end': '17-10-2012'}])
self.machine.repairing |should| equal_to(False)
Machine.available |should| contain(self.machine)
(self.machine.finish_repair, '17-10-2012') |should| throw(MachineNotInRepair)
def test_problematic_machine(self):
for i in range(11):
self.machine.repair('supervisor', '16-10-2012')
self.machine.finish_repair('17-10-2012')
len(self.machine.repairs) |should| equal_to(11)
Machine.problematic_machines |should| contain(self.machine)
def test_machines_avaiable(self):
Machine.available_machines() |should| equal_to('producer: Janome sewing types: overlock, zig-zag, costura reta')