Exemple #1
0
 def test_student_names_with_grades_are_displayed_in_the_same_sorted_roster(self):
     school = School()
     school.add_student(name="Peter", grade=2)
     school.add_student(name="Anna", grade=1)
     school.add_student(name="Barb", grade=1)
     school.add_student(name="Zoe", grade=2)
     school.add_student(name="Alex", grade=2)
     school.add_student(name="Jim", grade=3)
     school.add_student(name="Charlie", grade=1)
     expected = ["Anna", "Barb", "Charlie", "Alex", "Peter", "Zoe", "Jim"]
     self.assertEqual(school.roster(), expected)
 def test_roster_is_sorted_by_grade_then_name(self):
     school = School()
     for name, grade in [
         ('Peter', 2),
         ('Anna', 1),
         ('Barb', 1),
         ('Zoe', 2),
         ('Alex', 2),
         ('Jim', 3),
         ('Charlie', 1),
     ]:
         school.add_student(name, grade)
     expected = ['Anna', 'Barb', 'Charlie', 'Alex', 'Peter', 'Zoe', 'Jim']
     self.assertEqual(school.roster(), expected)
 def test_roster_is_sorted_by_grade_then_name(self):
     school = School()
     for name, grade in [
         ("Peter", 2),
         ("Anna", 1),
         ("Barb", 1),
         ("Zoe", 2),
         ("Alex", 2),
         ("Jim", 3),
         ("Charlie", 1),
     ]:
         school.add_student(name, grade)
     expected = ["Anna", "Barb", "Charlie", "Alex", "Peter", "Zoe", "Jim"]
     self.assertEqual(school.roster(), expected)
Exemple #4
0
 def test_grade_returns_an_empty_list_if_there_are_no_students_in_that_grade(
         self):
     school = School()
     expected = []
     self.assertEqual(school.grade(1), expected)
Exemple #5
0
 def test_roster_returns_an_empty_list_if_there_are_no_students_enrolled(
         self):
     school = School()
     expected = []
     self.assertEqual(school.roster(), expected)
Exemple #6
0
 def test_roster_is_empty_when_no_student_is_added(self):
     school = School()
     expected = []
     self.assertEqual(school.roster(), expected)
Exemple #7
0
 def test_grade_is_empty_if_no_students_in_the_roster(self):
     school = School()
     expected = []
     self.assertEqual(school.grade(1), expected)
Exemple #8
0
 def test_students_in_multiple_grades_are_added_to_the_roster(self):
     school = School()
     school.add_student(name="Chelsea", grade=3)
     school.add_student(name="Logan", grade=7)
     expected = ["Chelsea", "Logan"]
     self.assertEqual(school.roster(), expected)
Exemple #9
0
 def test_student_is_added_to_the_roster(self):
     school = School()
     school.add_student(name="Aimee", grade=2)
     expected = ["Aimee"]
     self.assertEqual(school.roster(), expected)
Exemple #10
0
 def test_adding_students_in_multiple_grades(self):
     school = School()
     school.add_student(name="Chelsea", grade=3)
     school.add_student(name="Logan", grade=7)
     expected = [True, True]
     self.assertEqual(school.added(), expected)
Exemple #11
0
 def test_add_a_student(self):
     school = School()
     school.add_student(name="Aimee", grade=2)
     expected = [True]
     self.assertEqual(school.added(), expected)
 def test_grade_returns_empty_list_if_no_students_are_in_that_grade(self):
     self.assertEqual(School().grade(1), [])
 def test_roster_returns_empty_list_if_no_students_are_enrolled(self):
     self.assertEqual(School().roster(), [])
 def test_students_in_different_grades_in_same_roster(self):
     school = School()
     school.add_student(name="Chelsea", grade=3)
     school.add_student(name="Logan", grade=7)
     expected = ["Chelsea", "Logan"]
     self.assertEqual(school.roster(), expected)
Exemple #15
0
 def test_adding_a_student_adds_them_to_the_sorted_roster(self):
     school = School()
     school.add_student(name="Aimee", grade=2)
     expected = ["Aimee"]
     self.assertEqual(school.roster(), expected)
 def test_change_grade_of_student(self):
     with self.assertRaisesWithMessage(ValueError):
         school = School()
         school.add_student(name="Johnny", grade=10)
         school.add_student(name="Johnny", grade=5)
Exemple #17
0
 def setUp(self):
     # assertCountEqual is py3, py2 only knowns assetItemsEqual
     if not hasattr(self, 'assertCountEqual'):
         self.assertCountEqual = self.assertItemsEqual
     self.school = School("Haleakala Hippy School")
 def test_students_in_different_grades_in_same_roster(self):
     school = School()
     school.add_student(name='Chelsea', grade=3)
     school.add_student(name='Logan', grade=7)
     expected = ['Chelsea', 'Logan']
     self.assertEqual(school.roster(), expected)