def test_makes_marking_period_accessible_by_dictionary(self): subject = Subject('H Chemistry') self.assertIsInstance(subject.mp[1], MarkingPeriod) self.assertIsInstance(subject.mp[2], MarkingPeriod) self.assertIsInstance(subject.mp[3], MarkingPeriod) self.assertIsInstance(subject.mp[4], MarkingPeriod)
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])
def test_not_passing_if_final_is_lower_than_60(self): subject = Subject('AP Chemistry') subject.sem1.mp1.grade = 50.00 subject.sem1.mp2.grade = 50.00 subject.sem2.mp1.grade = 50.00 subject.sem2.mp2.grade = 50.00 self.assertEqual(subject.passed, False)
def test_has_public_property_which_calculates_final_grade_when_subject_is_not_full_year( self): subject = Subject.half_year('CAD1') subject.sem2.mp1.grade = 95.02 subject.sem2.mp2.grade = 98.49 self.assertEqual(subject.final.unweighted, 97) self.assertEqual(subject.final.weighted, 48.5)
def test_passes_if_final_is_higher_than_60_and_grades_are_complete_with_both_or_neither_of_the_exams( self): subject = Subject('AP Chemistry') subject.sem1.mp1.grade = 97.52 subject.sem1.mp2.grade = 93.83 subject.sem1.exam = 89 subject.sem2.mp1.grade = 95.29 subject.sem2.mp2.grade = 87.02 subject.sem2.exam = 92 self.assertEqual(subject.passed, True)
def test_has_public_property_which_calculates_final_grade_when_subject_is_full_year( self): subject = Subject.advanced_placement('AP Chemistry') subject.sem1.mp1.grade = 97.52 subject.sem1.mp2.grade = 93.83 subject.sem1.exam = 89 subject.sem2.mp1.grade = 95.29 subject.sem2.mp2.grade = 87.02 subject.sem2.exam = 92 self.assertEqual(subject.final.unweighted, 93) self.assertEqual(subject.final.weighted, 102.3)
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)
def test_passed_is_none_if_grades_are_not_complete(self): subject = Subject('AP Chemistry') subject.sem1.mp1.grade = 97.52 subject.sem2.mp1.grade = 95.29 subject.sem2.mp2.grade = 87.02 self.assertEqual(subject.passed, None) # Corona Virus Canceled one of the exams # def test_passed_is_none_if_only_one_of_the_exams(self): # subject = Subject('AP Chemistry') # subject.sem1.mp1.grade = 97.52 # subject.sem1.mp2.grade = 93.83 # subject.sem2.mp1.grade = 95.29 # subject.sem2.mp2.grade = 87.02 # subject.sem2.exam = 92 # self.assertEqual(subject.passed, None)
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, [])
def test_takes_name(self): subject = Subject(name='H English 10') self.assertEqual(subject.name, 'H English 10')
def test_creates_sem1_and_sem2_objects(self): subject = Subject(name='Intro to Python') self.assertIsInstance(subject.sem1, Semester) self.assertIsInstance(subject.sem2, Semester)
def test_figures_out_credit_from_subject_type(self): subject = Subject.advanced_placement(name='AP Modern World History') elective = Subject.half_year(name='Intro to Python') self.assertEqual(subject.credit, 1.00) self.assertEqual(elective.credit, 0.50)
def test_has_class_methods_for_determining_subject_type_and_weight(self): subject = Subject.advanced_placement(name='AP Modern World History') self.assertEqual(subject._full_year, True) self.assertEqual(subject._weight, 1.100)
def test_has_string_representation(self): subject = Subject(name='H Geometry') self.assertEqual(str(subject), 'H Geometry')
from school.student import Student from school.subject import Subject paul = Student(name='Paul') paul.year = 11 paul.mp = 1 CAD1 = Subject.half_year(name='CAD 1: Introduction to CADD') Graphics1 = Subject.half_year(name='Graphics 1') H_Algebra2 = Subject.honors(name='H Algebra 2') H_Ancient_World_History = Subject.honors(name='H Ancient World History') H_English9 = Subject.honors(name='H English 9') H_Physical_Science = Subject.honors(name='H Physical Science 1') Spanish2 = Subject.language(name='Spanish 2') gym = Subject.half_year(name='Sports & Fitness Course 1-Boys') subjects9 = [ CAD1, Graphics1, H_Algebra2, H_Ancient_World_History, H_English9, H_Physical_Science, Spanish2, gym ] CAD1.mp[1].grade = 99.00 CAD1.mp[2].grade = 99.00