Example #1
0
class TestSubjectProperData(unittest.TestCase):
    def __init__(self, init_test):
        super(TestSubjectProperData, self).__init__(init_test)

    def setUp(self):
        name = 'python'
        scores = [5, 4, 3, 4, 5, 3.5, 2, 2, 5, 3, 4.5]
        attendances = [1, 1, 1, 0, 1, 0, 0, 0]

        self.proper_subject_output = (name, (4, 8), sum(scores) / len(scores))
        self.testing_subject = Subject(name, scores, attendances)

    def tearDown(self):
        self.proper_subject_output = None
        self.testing_subject = None

    def test_get_average_score_method(self):
        testing_value = self.testing_subject.get_average_score()
        proper_value = self.proper_subject_output[2]
        self.assertEqual(testing_value, proper_value)

    def test_get_attendance_method(self):
        testing_value = self.testing_subject.get_attendance()
        proper_value = self.proper_subject_output[1]
        self.assertEqual(testing_value, proper_value)

    def test_get_subject_name_method(self):
        testing_value = self.testing_subject.get_subject_name()
        proper_value = self.proper_subject_output[0]
        self.assertEqual(testing_value, proper_value)
Example #2
0
 def test_empty_scores_list(self):
     subject = Subject(self.proper_name, list(), self.proper_attendances)
     subject.get_average_score()