def calculate_button(self, text_input): # TODO: add handling for accidental space press try: grade_percentage = kivy_grade_calc.grade_converter( float(text_input.strip())) self.result.text = str(grade_percentage) self.display.text = '' except ValueError: pass
def test_grade_converter_pd_high(self): result = kivy_grade_calc.grade_converter(4) self.assertEqual(100, result)
def test_grade_converter_n_low(self): result = kivy_grade_calc.grade_converter(0) self.assertEqual(0, result)
def test_grade_converter_error(self): result = kivy_grade_calc.grade_converter(4.1) self.assertEqual('Grade is out of range', result)
def test_grade_converter_i_low(self): result = kivy_grade_calc.grade_converter(1.5) self.assertEqual(55, result)
def test_grade_converter_n_high(self): result = kivy_grade_calc.grade_converter(1.4) self.assertEqual(54, result)
def test_grade_converter_i_high(self): result = kivy_grade_calc.grade_converter(1.9) self.assertEqual(65, result)
def test_grade_converter_bp_low(self): result = kivy_grade_calc.grade_converter(2) self.assertEqual(66, result)
def test_grade_converter_bp_high(self): result = kivy_grade_calc.grade_converter(2.4) self.assertEqual(75, result)
def test_grade_converter_p_high(self): result = kivy_grade_calc.grade_converter(3.4) self.assertEqual(91, result)
def test_grade_converter_pd_low(self): result = kivy_grade_calc.grade_converter(3.5) self.assertEqual(92, result)