예제 #1
0
 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
예제 #2
0
    def test_grade_converter_pd_high(self):
        result = kivy_grade_calc.grade_converter(4)

        self.assertEqual(100, result)
예제 #3
0
    def test_grade_converter_n_low(self):
        result = kivy_grade_calc.grade_converter(0)

        self.assertEqual(0, result)
예제 #4
0
    def test_grade_converter_error(self):
        result = kivy_grade_calc.grade_converter(4.1)

        self.assertEqual('Grade is out of range', result)
예제 #5
0
    def test_grade_converter_i_low(self):
        result = kivy_grade_calc.grade_converter(1.5)

        self.assertEqual(55, result)
예제 #6
0
    def test_grade_converter_n_high(self):
        result = kivy_grade_calc.grade_converter(1.4)

        self.assertEqual(54, result)
예제 #7
0
    def test_grade_converter_i_high(self):
        result = kivy_grade_calc.grade_converter(1.9)

        self.assertEqual(65, result)
예제 #8
0
    def test_grade_converter_bp_low(self):
        result = kivy_grade_calc.grade_converter(2)

        self.assertEqual(66, result)
예제 #9
0
    def test_grade_converter_bp_high(self):
        result = kivy_grade_calc.grade_converter(2.4)

        self.assertEqual(75, result)
예제 #10
0
    def test_grade_converter_p_high(self):
        result = kivy_grade_calc.grade_converter(3.4)

        self.assertEqual(91, result)
예제 #11
0
    def test_grade_converter_pd_low(self):
        result = kivy_grade_calc.grade_converter(3.5)

        self.assertEqual(92, result)