class StudentTests(unittest.TestCase):
    def setUp(self):
        self.st = Student("Random", 5)

    def test_get_name(self):
        self.assertEqual("Random", self.st.get_name())

    def test_get_scores_count(self):
        self.assertEqual(1, self.st.get_scores_count())

    def test_get_total_score(self):
        self.assertEqual(5, self.st.get_total_score())

    def test_add_quiz(self):
        self.st.add_quiz(Grade("A"))
        self.assertEqual(2, self.st.get_scores_count())
        self.assertEqual(10, self.st.get_total_score())

    def test_get_average_score(self):
        self.st.add_quiz(Grade("B"))
        self.assertEqual(9 / 2, self.st.get_average_score())
Example #2
0
class StudentTests(unittest.TestCase):
    def setUp(self):
        self.st = Student("Random", 5)

    def test_get_name(self):
        self.assertEqual("Random", self.st.get_name())

    def test_get_scores_count(self):
        self.assertEqual(1, self.st.get_scores_count())

    def test_get_total_score(self):
        self.assertEqual(5, self.st.get_total_score())

    def test_add_quiz(self):
        self.st.add_quiz(Grade("A"))
        self.assertEqual(2, self.st.get_scores_count())
        self.assertEqual(10, self.st.get_total_score())

    def test_get_average_score(self):
        self.st.add_quiz(Grade("B"))
        self.assertEqual(9 / 2, self.st.get_average_score())
 def setUp(self):
     self.st = Student("Random", 5)
Example #4
0
 def setUp(self):
     self.st = Student("Random", 5)