Esempio n. 1
0
 def testR11(self):
     students = student.parseStudents("students.txt")
     self.assertEqual(
         R11(students),
         [['Grade 0', '0'], ['Grade 1', '2'], ['Grade 2', '13'],
          ['Grade 3', '9'], ['Grade 4', '15'], ['Grade 5', '0'],
          ['Grade 6', '21']])
Esempio n. 2
0
 def testR6(self):
     students = student.parseStudents("students.txt")
     self.assertEqual(
         R6(students, "HAMER"),
         [["LIBRANDI", "TODD"], ["HAVIR", "BOBBIE"], ["SARAO", "DIEDRA"],
          ["VANCOTT", "MIKE"], ["WICINSKY", "TERESE"], ["KOZOLA", "BUSTER"],
          ["MULLINGS", "LEIGHANN"], ["BUSSMANN", "BILLY"],
          ["BERBES", "DICK"], ["MULGREW", "RANDELL"], ["TOWLEY", "LANE"]])
     self.assertEqual(R6(students, "ZHAI"), [])
Esempio n. 3
0
 def testALL(self):
     students = student.parseStudents("test.txt")
     self.assertEqual(schoolsearch.checkLoadFile(students), False)
     students = student.parseStudents("students.txt")
     self.assertEqual(schoolsearch.checkLoadFile(students), True)
     self.assertEqual(R4(students, "HAVIR"),
                      [["HAVIR", "BOBBIE", "2", "108", "HAMER", "GAVIN"]])
     self.assertEqual(R5(students, "HAVIR"), [["HAVIR", "BOBBIE", "0"]])
     self.assertEqual(
         R6(students, "HAMER"),
         [["LIBRANDI", "TODD"], ["HAVIR", "BOBBIE"], ["SARAO", "DIEDRA"],
          ["VANCOTT", "MIKE"], ["WICINSKY", "TERESE"], ["KOZOLA", "BUSTER"],
          ["MULLINGS", "LEIGHANN"], ["BUSSMANN", "BILLY"],
          ["BERBES", "DICK"], ["MULGREW", "RANDELL"], ["TOWLEY", "LANE"]])
     self.assertEqual(R6(students, "ZHAI"), [])
     self.assertEqual(R7(students, "1"),
                      [["SAELEE", "DANILO"], ["GARTH", "JOHN"]])
     self.assertEqual(R7(students, "99"), [])
     self.assertEqual(R8(students, "51"),
                      [["WOOLERY", "NOLAN", "2", "104"],
                       ["STERBACK", "PETER", "6", "111"],
                       ["LIBRANDI", "TODD", "2", "108"],
                       ["RAPOSE", "ALONZO", "4", "105"],
                       ["COVINGTON", "TOMAS", "3", "107"],
                       ["MULLINGS", "LEIGHANN", "2", "108"],
                       ["DURAND", "CARLEE", "4", "101"],
                       ["FRIEDSTROM", "REED", "6", "106"]])
     self.assertEqual(R8(students, "1000"), [])
     self.assertEqual(
         R9(students, "3 H"),
         [["SWEDLUND", "SHARRI", "3.24", "FAFARD", "ROCIO", "55"]])
     self.assertEqual(
         R9(students, "3 Low"),
         [["CIGANEK", "MANIE", "2.79", "FAFARD", "ROCIO", "53"]])
     self.assertEqual(R9(students, "99 Low"), [])
     self.assertEqual(R9(students, "99 High"), [])
     self.assertEqual(R10(students, "3"), [["3,3.05"]])
     self.assertEqual(R10(students, "99"), [])
     self.assertEqual(
         R11(students),
         [['Grade 0', '0'], ['Grade 1', '2'], ['Grade 2', '13'],
          ['Grade 3', '9'], ['Grade 4', '15'], ['Grade 5', '0'],
          ['Grade 6', '21']])
Esempio n. 4
0
 def testR9(self):
     students = student.parseStudents("students.txt")
     self.assertEqual(
         R9(students, "3 H"),
         [["SWEDLUND", "SHARRI", "3.24", "FAFARD", "ROCIO", "55"]])
     self.assertEqual(
         R9(students, "3 Low"),
         [["CIGANEK", "MANIE", "2.79", "FAFARD", "ROCIO", "53"]])
     self.assertEqual(R9(students, "99 Low"), [])
     self.assertEqual(R9(students, "99 High"), [])
Esempio n. 5
0
def main():
    students = student.parseStudents("students.txt")
    not_quit = checkLoadFile(students)

    while not_quit:
        user_in = input().split(" ")
        if user_in[0][0] == 'S':
            if len(user_in) == 3 and user_in[2][0] == 'B':
                output = R5(students, user_in[1])
                printOutput(output)
            elif len(user_in) == 2:
                output = R4(students, user_in[1])
                printOutput(output)
            else:
                print("Invalid number of arguments")
                print("Usage: S[tudent]: <lastname> [B[us]]")
        elif user_in[0][0] == 'T':
            if len(user_in) == 2:
                output = R6(students, user_in[1])
                printOutput(output)
            else:
                print("Invalid number of arguments")
                print("Usage: T[eacher]: <lastname>")
        elif user_in[0][0] == 'B':
            if len(user_in) == 2:
                output = R8(students, user_in[1])
                printOutput(output)
            else:
                print("Invalid number of arguments")
                print("Usage: B[us]: <number>")
        elif user_in[0][0] == 'G':
            if len(user_in) == 3:
                output = R9(students, " ".join(user_in[1:]))
                printOutput(output)
            elif len(user_in) == 2:
                output = R7(students, user_in[1])
                printOutput(output)
            else:
                print("Invalid number of arguments")
                print("Usage: G[rade]: <number> [H[igh]|L[ow]]")
        elif user_in[0][0] == 'A':
            if len(user_in) == 2:
                output = R10(students, user_in[1])
                printOutput(output)
            else:
                print("Invalid number of arguments")
                print("Usage: A[verage]: <number>")
        elif len(user_in) == 1 and user_in[0][0] == 'I':
            output = R11(students)
            printInfo(output)
        elif user_in[0][0] == 'Q':
            not_quit = False
        else:
            print("Invalid command")
Esempio n. 6
0
 def testR8(self):
     students = student.parseStudents("students.txt")
     self.assertEqual(R8(students, "51"),
                      [["WOOLERY", "NOLAN", "2", "104"],
                       ["STERBACK", "PETER", "6", "111"],
                       ["LIBRANDI", "TODD", "2", "108"],
                       ["RAPOSE", "ALONZO", "4", "105"],
                       ["COVINGTON", "TOMAS", "3", "107"],
                       ["MULLINGS", "LEIGHANN", "2", "108"],
                       ["DURAND", "CARLEE", "4", "101"],
                       ["FRIEDSTROM", "REED", "6", "106"]])
     self.assertEqual(R8(students, "1000"), [])
Esempio n. 7
0
 def ErrorHandling(self):
     students = student.parseStudents("test.txt")
     self.assertEqual(schoolsearch.checkLoadFile(students), False)
     students = student.parseStudents("students.txt")
     self.assertEqual(schoolsearch.checkLoadFile(students), True)
Esempio n. 8
0
 def testR10(self):
     students = student.parseStudents("students.txt")
     self.assertEqual(R10(students, "3"), [["3,3.05"]])
     self.assertEqual(R10(students, "99"), [])
Esempio n. 9
0
 def testR7(self):
     students = student.parseStudents("students.txt")
     self.assertEqual(R7(students, "1"),
                      [["SAELEE", "DANILO"], ["GARTH", "JOHN"]])
     self.assertEqual(R7(students, "99"), [])
Esempio n. 10
0
 def testR5(self):
     students = student.parseStudents("students.txt")
     self.assertEqual(R5(students, "HAVIR"), [["HAVIR", "BOBBIE", "0"]])
     self.assertEqual(R4(students, "LIN"), [])
Esempio n. 11
0
 def testR4(self):
     students = student.parseStudents("students.txt")
     self.assertEqual(R4(students, "HAVIR"),
                      [["HAVIR", "BOBBIE", "2", "108", "HAMER", "GAVIN"]])
     self.assertEqual(R4(students, "LIN"), [])