Example #1
0
    def test_get_text(self):
        value = BoolValue(true_text="Yes", false_text="No")
        text = value.get_text(self.model, [0], [0])
        self.assertEqual(text, "Yes")

        self.model.get_value = Mock(return_value=False)
        text = value.get_text(self.model, [0], [0])
        self.assertEqual(text, "No")
Example #2
0
    def test_get_text_default(self):
        value = BoolValue()
        text = value.get_text(self.model, [0], [0])
        self.assertEqual(text, "")

        self.model.get_value = Mock(return_value=False)
        text = value.get_text(self.model, [0], [0])
        self.assertEqual(text, "")
Example #3
0
 def test_set_check_state_no_set_value(self):
     self.model.can_set_value = Mock(return_value=False)
     value = BoolValue()
     with self.assertRaises(DataViewSetError):
         value.set_text(self.model, [0], [0], CheckState.CHECKED)
Example #4
0
 def test_set_check_state_unchecked(self):
     value = BoolValue()
     value.set_check_state(self.model, [0], [0], CheckState.UNCHECKED)
     self.model.set_value.assert_called_once_with([0], [0], False)
Example #5
0
 def test_get_check_state_false(self):
     value = BoolValue()
     self.model.get_value = Mock(return_value=False)
     check_state = value.get_check_state(self.model, [0], [0])
     self.assertEqual(check_state, CheckState.UNCHECKED)
Example #6
0
 def test_get_check_state(self):
     value = BoolValue()
     check_state = value.get_check_state(self.model, [0], [0])
     self.assertEqual(check_state, CheckState.CHECKED)
Example #7
0
 def test_has_text(self):
     value = BoolValue(true_text="Yes", false_text="No")
     has_text = value.has_text(self.model, [0], [0])
     self.assertTrue(has_text)
Example #8
0
 def test_has_text_default(self):
     value = BoolValue()
     has_text = value.has_text(self.model, [0], [0])
     self.assertFalse(has_text)
Example #9
0
 def test_defaults(self):
     value = BoolValue()
     self.assertEqual(value.true_text, "")
     self.assertEqual(value.false_text, "")