def test_delta_update_limits(self):
     hb = ParamHintBox()
     hb.vary_e.setCurrentText('delta')
     self.assertEqual((-1, 1), (hb.min_e.value(), hb.max_e.value()))
     hb.setValues(value=10)
     self.assertEqual((9, 11), (hb.min_e.value(), hb.max_e.value()))
     hb.vary_e.setCurrentText('limits')
     self.assertEqual((9, 11), (hb.min_e.value(), hb.max_e.value()))
 def test_delta_update_limits(self):
     h = {'vary': 'limits'}
     hb = ParamHintBox(h)
     hb.vary_e.setCurrentText('delta')
     hb.setValues()  # an Editor should run this
     self.assertEqual((-1, 1), (hb.min_e.value(), hb.max_e.value()))
     hb.val_e.setValue(10)
     hb.setValues()
     self.assertEqual((9, 11), (hb.min_e.value(), hb.max_e.value()))
     hb.vary_e.setCurrentText('limits')
     hb.setValues()
     self.assertEqual((9, 11), (hb.min_e.value(), hb.max_e.value()))
     hb.vary_e.setCurrentText('delta')
     h['value'] = 20
     hb.update_min_max_for_delta()  # should be called after line move
     self.assertEqual((19, 21), (hb.min_e.value(), hb.max_e.value()))
 def test_keep_delta(self):
     h = {'vary': 'limits'}
     hb = ParamHintBox(h)
     hb.vary_e.setCurrentText('delta')
     hb.setValues()  # an Editor should run this
     self.assertEqual('delta', h['vary'])
     self.assertEqual((-1, 1), (h['min'], h['max']))
     self.assertEqual((-1, 1), (hb.min_e.value(), hb.max_e.value()))
     hb.vary_e.setCurrentText('limits')
     hb.setValues()  # an Editor should run this
     self.assertEqual('limits', h['vary'])
     self.assertEqual((-1, 1), (h['min'], h['max']))
     self.assertEqual((-1, 1), (hb.min_e.value(), hb.max_e.value()))
     hb.vary_e.setCurrentText('delta')
     hb.setValues()  # an Editor should run this
     self.assertEqual((-1, 1), (h['min'], h['max']))
     self.assertEqual((-1, 1), (hb.min_e.value(), hb.max_e.value()))
 def test_expr_set_hint(self):
     hb = ParamHintBox(init_hints=OrderedDict([('expr', "test")]))
     hb.setValues(expr="")
     self.assertEqual('limits', hb.vary_e.currentText())
     self.assertEqual("", hb.param_hints()['expr'])
 def test_delta_restore_from_saved_hints(self):
     hb = ParamHintBox()
     hb.setValues(value=15.3, min=10.3, max=20.3)
     self.assertEqual('delta', hb.vary_e.currentText())
     self.assertEqual(5.0, hb.delta_e.value())