Ejemplo n.º 1
0
 def __init__(self, name: str):
     self.name = name
     self._year = 0  # Grade
     self._mp = 0  # current
     self.high_school = {
         9: Year(9),
         10: Year(10),
         11: Year(11),
         12: Year(12),
     }
Ejemplo n.º 2
0
    def setUp(self):
        python = Subject.half_year(name='Intro to Python')
        history = Subject.advanced_placement(name='AP Modern World History')
        english = Subject.honors(name='H English')
        science = Subject.college_prep(name='CP Biology')
        math = Subject.honors(name='H Geometry')
        spanish = Subject.language(name='Spanish 3')

        python.sem1.mp1.grade = 98.07
        python.sem1.mp2.grade = 99.42
        history.sem1.mp1.grade = 93.71
        history.sem1.mp2.grade = 89.29
        history.sem1.exam = 76
        english.sem1.mp1.grade = 92.30
        english.sem1.mp2.grade = 96.85
        science.sem1.mp1.grade = 95.04
        science.sem1.mp2.grade = 94.95
        math.sem1.mp1.grade = 97.34
        math.sem1.mp2.grade = 99.49
        spanish.sem1.mp1.grade = 91.72
        spanish.sem1.mp2.grade = 91.80

        self.subjects = [python, history, english, science, math, spanish]

        self.year = Year(year=9)
        self.year.extend_subjects(subjects=self.subjects)
Ejemplo n.º 3
0
    def test_knows_when_year_is_not_completed(self):
        year = Year(year=9)
        year.extend_subjects(
            subjects=[MagicMock(
                passed=True), MagicMock(passed=None)])

        self.assertEqual(year.completed, False)
Ejemplo n.º 4
0
    def test_can_extend_the_list_of_subjects(self):
        subject = Subject('English')

        year = Year(year=10)
        year.extend_subjects(subjects=[subject])

        self.assertEqual(year.subjects, [subject])
Ejemplo n.º 5
0
    def test_figures_out_credits_earned_out_of_total_credits(self):
        year = Year(year=9)
        year.extend_subjects(subjects=self.subjects)
        year.extend_subjects(subjects=[
            MagicMock(credit=1, final=Grade(grade=49.26), passed=False)
        ])

        self.assertEqual(year.credits, 4)
        self.assertEqual(year.credits_earned, 3)
Ejemplo n.º 6
0
    def setUp(self):
        python = MagicMock(credit=0.500,
                           final=Grade(grade=98.07, weight=0.500),
                           passed=True)
        python.name = 'python'
        history = MagicMock(name='history',
                            credit=1.000,
                            final=Grade(grade=92.71, weight=1.100),
                            passed=True)
        history.name = 'history'
        science = MagicMock(name='science',
                            credit=1.000,
                            final=Grade(grade=55.89, weight=1.000),
                            passed=False)
        science.name = 'science'
        gym = MagicMock(name='gym',
                        credit=0.500,
                        final=Grade(grade=99.02, weight=0.500),
                        passed=True)
        gym.name = 'gym'
        english = MagicMock(name='english',
                            credit=1.000,
                            final=Grade(grade=94.30, weight=1.050),
                            passed=True)
        english.name = 'english'
        math = MagicMock(name='math',
                         credit=1.000,
                         final=Grade(grade=98.63, weight=1.050),
                         passed=True)
        math.name = 'math'

        self.subjects9 = [python, history, science]

        self.subjects10 = [gym, english, math]

        self.year9 = Year(year=9)
        self.year9.extend_subjects(subjects=self.subjects9)
        self.year10 = Year(year=10)
        self.year10.extend_subjects(subjects=self.subjects10)

        self.years = [self.year9, self.year10]
Ejemplo n.º 7
0
    def test_has_unweighted_and_weighted_gpa(self):
        year = Year(year=9)
        year.extend_subjects(subjects=self.subjects)

        self.assertEqual(year.unweighted_gpa, 3.780)
        self.assertEqual(year.weighted_gpa, 4.280)
Ejemplo n.º 8
0
    def test_calculates_unweighted_and_weighted_nga(self):
        year = Year(year=9)
        year.extend_subjects(subjects=self.subjects)

        self.assertEqual(year.unweighted_nga, 94.667)
        self.assertEqual(year.weighted_nga, 99.450)
Ejemplo n.º 9
0
    def test_remove_subject_raises_lookup_error_if_name_that_does_not_exist_in_subjects_list(
            self):
        year = Year(year=11)

        with self.assertRaises(LookupError):
            year.remove_subject('Math')
Ejemplo n.º 10
0
    def test_can_remove_a_subject_from_the_list_of_subjects(self):
        year = Year(year=11)
        year.extend_subjects(subjects=[Subject('Math')])
        year.remove_subject(remove='Math')

        self.assertEqual(year.subjects, [])
Ejemplo n.º 11
0
    def test_has_year_and_subjects_list(self):
        year = Year(year=9)

        self.assertEqual(year.year, 9)
        self.assertEqual(year.subjects, [])