Пример #1
0
	def test_get_grades(self):
		self.minilist = [random.randint(1, 15000)]
		self.maxilist = []
		for k in range(0,10):
			self.maxilist.append(random.randint(1, 15000))
	
		empty = grading.get_grades(None, None)
		self.assertTrue(type(empty) == types.ListType)
		for e in empty:
			self.assertTrue(type(e) == types.TupleType)
		
		full = grading.get_grades(self.res_output_dir, self.maxilist)
		self.assertTrue(type(full) == types.ListType)
		for f in full:
			self.assertTrue(type(f) == types.TupleType)

		self.assertRaises(TypeError, grading.get_grades, 2.34)
		self.assertRaises(TypeError, grading.get_grades, 2.34, None)
		self.assertRaises(TypeError, grading.get_grades, None, 2.34)
Пример #2
0
	""" % tdata
				return render_to_response('report.html', {	
									'report_title' 		: title,
									'report_content' 	: report_content,
									'before_extra_content'	: """<form action="/youpi/report/global/%s/%s/" id="report_form" method="post">""" % (reportId, format),
				}, context_instance = RequestContext(request))

			# Final res list
			f_res = []
			for r in res:
				f_res.append(list(r))

			# Handle grades/comments
			if 'Grade' in cols or 'Comment' in cols:
				from terapix.script.grading import get_grades
				grades = get_grades(idList = [r[0] for r in res])
				# Dict with img id as a key
				idGrades = {}
				for g in grades:
					idGrades[g[4]] = g[:-1]

				# Merge grades with previous results
				if 'Grade' in cols:
					if 'Comment' in cols:
						for r in f_res:
							if idGrades.has_key(r[0]):
								r.append(idGrades[r[0]][1])
								r.append(idGrades[r[0]][2])
					else:
						for r in f_res:
							if idGrades.has_key(r[0]):