Пример #1
0
	def testReadAllMajorData(self):
		print "----------UNIT TEST-------"
		CompSci = Major("CS.req")
		error = 0
		
		#if file does not exist
		if not os.path.exists("CS.req"):
			print "Error, file does not exist"
			error = 1
			
		# if file was not formatted properly
		if (CompSci.getName().strip() != 'Computer Science'):
			print "Error, file formatted incorrectly"
			error = 1
		if (CompSci.getTotalHoursRequired() != 128):
			print "Error, file formatted incorrectly" 
			error = 1
		
		#output requirements
		#print CompSci.printReq()
		if (error == 0):
			print "ALL ERROR CHECKS PASSED"
		print "---------------------------"
		print
		print
Пример #2
0
	def testAddCourseToRequirement(self):
		print "----------UNIT TEST-------"
		CompSci = Major("CS.req")
		found = 0
		courseData = ("CS" , "53")
		usingReq = None

		for requirement in CompSci.requirements:
			if courseData in requirement.getCourses():
				usingReq = requirement
			
		oldReq = CompSci.requirements[:]
		course = self.genDummyCourse()
		
		CompSci.addCourseToRequirement(course, usingReq)
		
		if usingReq in CompSci.getRequirements():
			print "Error, valid course not added"
		else:
			print "ALL ERROR CHECKS PASSED"
		print "---------------------------"
Пример #3
0
	def testAddCourse(self):
		print "----------UNIT TEST-------"
		CompSci = Major("CS.req")
		found = 0
		# self.sc.populateCourseData()
		# self.sc.printAllCourses()
		oldReq = CompSci.requirements[:]
		course = self.genDummyCourse()
		
		CompSci.addCourse(course)
		newReq = CompSci.requirements[:]
		courseData = "CS" , "53"
		
		for requirement in oldReq:
			if requirement not in newReq:
				for missingCourse in requirement.getCourses():
					if(missingCourse[0] == courseData[0] and missingCourse[1] == courseData[1]):
						found = 1
		if (found == 0):
			print "Error, valid course not added"
		else:
			print "ALL ERROR CHECKS PASSED"
		print "---------------------------"