def test_operation_division_second_numerator_zero_calculate_button_disabled( self): viewmodel = RationalNumberViewModel() viewmodel.set_first_number("12/3") viewmodel.set_second_number("0/1") viewmodel.set_operation("/") self.assertEqual("disabled", viewmodel.get_calculate_button_state())
def test_calculate_button_disabled_by_default(self): viewmodel = RationalNumberViewModel() self.assertEqual("disabled", viewmodel.get_calculate_button_state())
def test_operation_invalid_calculate_button_disabled(self): viewmodel = RationalNumberViewModel() viewmodel.set_operation("%") self.assertEqual("disabled", viewmodel.get_calculate_button_state())
def test_numbers_invalid_calculate_button_disabled(self): viewmodel = RationalNumberViewModel() viewmodel.set_first_number("a") viewmodel.set_second_number("2/7") self.assertEqual("disabled", viewmodel.get_calculate_button_state())
def test_numbers_filled_calculate_button_enabled(self): viewmodel = RationalNumberViewModel() viewmodel.set_first_number("1/2") viewmodel.set_second_number("2/7") self.assertEqual("normal", viewmodel.get_calculate_button_state())
def test_denominator_of_number_zero_calculate_button_disabled(self): viewmodel = RationalNumberViewModel() viewmodel.set_first_number("12/0") viewmodel.set_second_number("2/7") viewmodel.set_operation("+") self.assertEqual("disabled", viewmodel.get_calculate_button_state())