def test_create_learning_path(self): solution_list = create_list(sample_solution) student_tests = create_list(student_test) domain_orders = create_list(domain_order) domain_order_dict = create_domain_dict(domain_orders) student_list_dict = student_setup(update_values(student_tests)) #Check to see that all student results are in solution set self.assertEqual(all(create_learning_path(domain_order_dict, student) in solution_list for student in student_list_dict), True)
def test_create_domain_dict(self): domain = [ ["K", "BL","HM","RR"], ["1","BL","HM","RR","L"], ["2","R"] ] domain_result = create_domain_dict(domain) #Check if function returns a dictionary self.assertEqual(isinstance(domain_result, dict), True) #Check if function returns correcy key,value self.assertEqual(domain_result[2], ["R"]) #Check if function returns correct length of returned value self.assertEqual(len(domain_result), 3)
def index(request): if request.method == 'POST': domain_order = request.FILES['domainorder'] student_test = request.FILES['studenttests'] student_test_list = create_list(student_test) domain_order_list = create_list(domain_order) domain_order = create_domain_dict(domain_order_list) student_list = student_setup(update_values(student_test_list)) student_learning_paths = [] for student in student_list: student_order = create_learning_path(domain_order, student) student_learning_paths.append(student_order) html_table = create_html_table(student_learning_paths) context = {'myhtml': html_table} return JsonResponse(context) return render(request, 'index.html')