Esempio n. 1
0
 def test_number_of_failing_students_among_successful_student(self):
     ivanov = StudentMarks([2, 3, 4, 5])
     smirnov = StudentMarks([4, 3, 4, 4, 5])
     sidorov = StudentMarks([4, 5, 4, 5, 5, 5])
     journal = Register([ivanov, smirnov, sidorov])
     result = journal.count_of_losers()
     self.assertEqual(0, result)
Esempio n. 2
0
 def test_number_of_excellent_students_among_failing_student(self):
     ivanov = StudentMarks([2, 3, 2])
     smirnov = StudentMarks([2, 2, 2, 2, 5])
     sidorov = StudentMarks([3, 3, 4, 3])
     journal = Register([ivanov, smirnov, sidorov])
     result = journal.count_of_excellent()
     self.assertEqual(0, result)
Esempio n. 3
0
 def test_number_of_excellent_student(self):
     ivanov = StudentMarks([5, 5, 4, 5, 5])
     smirnov = StudentMarks([2, 3])
     sidorov = StudentMarks([4, 5, 4, 5, 5, 5])
     petrov = StudentMarks([2, 4])
     journal = Register([ivanov, smirnov, sidorov, petrov])
     result = journal.count_of_excellent()
     self.assertEqual(2, result)
Esempio n. 4
0
 def test_surnames_of_excellent_students(self):
     ivanov = StudentMarks([5, 5, 4, 5, 5])
     smirnov = StudentMarks([2, 3])
     sidorov = StudentMarks([4, 5, 4, 5, 5, 5])
     petrov = StudentMarks([2, 4])
     journal = Register([ivanov, smirnov, sidorov, petrov])
     result = journal.surnames_of_excellent_students()
     self.assertEqual([ivanov, sidorov], result)
Esempio n. 5
0
 def test_number_of_failing_student(self):
     ivanov = StudentMarks([2, 2, 2, 2])
     smirnov = StudentMarks([2, 3, 2, 2, 3])
     sidorov = StudentMarks([4, 5, 4, 5, 5, 5])
     petrov = StudentMarks([2, 3, 2])
     journal = Register([ivanov, smirnov, sidorov, petrov])
     result = journal.count_of_losers()
     self.assertEqual(3, result)
Esempio n. 6
0
 def test_number_of_successful_student(self):
     ivanov = StudentMarks([5, 5, 4, 5, 5])
     smirnov = StudentMarks([2, 3])
     sidorov = StudentMarks([4, 5, 4, 5, 5, 5])
     petrov = StudentMarks([2, 4])
     journal = Register([ivanov, smirnov, sidorov, petrov])
     result = journal.count_of_students_who_successfully_pass()
     self.assertEqual(2, result)
Esempio n. 7
0
 def test_surnames_of_successful_students(self):
     ivanov = StudentMarks([5, 5, 4, 5, 5])
     smirnov = StudentMarks([2, 3, 5, 5, 5, 5, 5])
     sidorov = StudentMarks([3, 5, 4, 3, 3, 3])
     petrov = StudentMarks([2, 4])
     journal = Register([ivanov, smirnov, sidorov, petrov])
     result = journal.students_who_successfully_pass()
     self.assertEqual([ivanov, smirnov, sidorov], result)
Esempio n. 8
0
 def click_button(self):
     self.logger.log('Button clicked')
     if self.button_convert_state != 'disabled':
         journal = Register([self.stud1, self.stud2, self.stud3])
         self.count_of_losers = journal.count_of_losers()
         self.count_of_students_who_successfully_pass = journal.count_of_students_who_successfully_pass(
         )
         self.count_of_excellent = journal.count_of_excellent()
         self.logger.log('Result: %s, %s, %s' %
                         (self.count_of_losers,
                          self.count_of_students_who_successfully_pass,
                          self.count_of_excellent))
 def validate_text(self):
     try:
         self.marks1 = self.parser_marks(self.txt_from_stud1_txt)
         stud1 = StudentMarks(self.marks1)
         self.marks2 = self.parser_marks(self.txt_from_stud2_txt)
         stud2 = StudentMarks(self.marks2)
         self.marks3 = self.parser_marks(self.txt_from_stud3_txt)
         stud3 = StudentMarks(self.marks3)
     except:
         self.set_btn_disabled()
     else:
         self.set_btn_enabled()
         journal = Register([stud1, stud2, stud3])
         self.count_of_losers = journal.count_of_losers()
         self.count_of_students_who_successfully_pass = journal.count_of_students_who_successfully_pass(
         )
         self.count_of_excellent = journal.count_of_excellent()
Esempio n. 10
0
 def test_add_student(self):
     journal = Register([])
     petrov = ([2, 3, 4, 5])
     journal.add_new_student(petrov)
     self.assertIn(petrov, journal.students)
Esempio n. 11
0
 def test_return_error_message_if_add_mark_greater_5(self):
     journal = Register([])
     self.assertRaises(ValueError, journal.add_new_student, [4, 3, 7, 5])
Esempio n. 12
0
 def test_number_of_success_students_not_negative(self):
     sidorov = StudentMarks([4, 5, 4, 5, 5, 5])
     journal = Register([sidorov])
     result = journal.count_of_students_who_successfully_pass()
     self.assertGreaterEqual(result, 0)
Esempio n. 13
0
 def test_return_error_message_if_add_mark_less_1(self):
     journal = Register([])
     self.assertRaises(ValueError, journal.add_new_student, [3, 1, 0, 5])
Esempio n. 14
0
 def test_return_error_message_if_add_negative_marks(self):
     journal = Register([])
     self.assertRaises(ValueError, journal.add_new_student, [-2, 3, -4, 5])
Esempio n. 15
0
 def test_return_error_message_if_add_invalid_type_of_marks(self):
     journal = Register([])
     self.assertRaises(TypeError, journal.add_new_student, ['two', 'three'])
Esempio n. 16
0
 def test_add_two_students(self):
     journal = Register([])
     self.assertRaises(TypeError, journal.add_new_student,
                       ([2, 3, 4, 5], [2]))
Esempio n. 17
0
 def test_number_of_excellent_students_not_negative(self):
     sidorov = StudentMarks([4, 5, 4, 5, 5, 5])
     journal = Register([sidorov])
     result = journal.count_of_excellent()
     self.assertGreaterEqual(result, 0)