Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(5)  |  Derive(0)  |  Import(2)

src/r/e/report_tool-HEAD/reporting/report.py   report_tool(Download)
from itertools import groupby
import os
from extract_information import extract_information, get_list_of_object
from django.http import HttpResponse, HttpResponseRedirect
 
            return 'Wrong input file, please check all data', response #if cannot extract the data, return wrong message
        else:
            message, list_objects = get_list_of_object(function_name,index_of_function, request)
 
            if message != 'ok':

src/r/e/report_tool-HEAD/reporting/tests.py   report_tool(Download)
from django.test import TestCase
from reporting.models import Upload, Spreadsheet_report
from datetime import datetime
from extract_information import get_list_of_object, extract_information
from generate_from_spreadsheet import upload_result
    def test_get_list_of_object(self):
        #test if the function get_list_of_object is correct
        message, objects_list = get_list_of_object('Upload.objects.all()', [(1,2)])
        self.assertEqual(message, 'ok') #check if the returned message is 'ok;
 
 
        #test for exception, when both argument of this function is empty:
        message, objects_list = get_list_of_object('',[])
        self.assertEqual(message, 'The data function should be specify!')
        self.assertEqual(objects_list, [])
 
        #test if the function is not correct, then the correct message should be returned
        message, objects_list = get_list_of_object('toilatung', [(1,2)])
 
        #test if the function if correct, but returned value of object_list is not appropriate
        message, objects_list = get_list_of_object('Upload.objects', [(1,2)])
        self.assertEqual(message, 'The function you defined returns wrong result (must return a list of objects):cell C2')
        self.assertEqual(objects_list, [])