def testValueUsed(self): v = trellis.Value(42) ctrl = self.mocker.replace(self.ctrl) #'peak.events.stm.ctrl') ctrl.used(v) self.mocker.replay() trellis.install_controller(ctrl) self.assertEqual(v.value, 42)
def testValueUnchanged(self): v = trellis.Value(42) ctrl = self.mocker.replace(self.ctrl) ctrl.lock(v) mocker.expect(ctrl.changed(v)).count(0) self.mocker.replay() trellis.install_controller(ctrl) v.value = 42 self.assertEqual(v.value, 42)
def testValueChanged(self): v = trellis.Value(42) old_ctrl, ctrl = self.ctrl, self.mocker.replace(self.ctrl) ctrl.lock(v) ctrl.changed(v) self.mocker.replay() trellis.install_controller(ctrl) v.value = 43 self.assertEqual(v.value, 43)
def tearDown(self): # make sure the old controller is back trellis.install_controller(self.ctrl)