コード例 #1
0
ファイル: peopleTest.py プロジェクト: BobbyJohansen/CsvSort
 def test_loadData_With_PLAIN(self):
     plainTextCSV = 'test.csv'
     #code under test
     response = people.loadData(plainTextCSV)
     self.assertIsNotNone(response, 'Response was None Error Opening File for Plain/Text (ascii)')
     self.assertTrue(len(response[0].keys()) > 0 , 'No Keys returned for person object') 
コード例 #2
0
ファイル: server.py プロジェクト: BobbyJohansen/CsvSort
        data = functionality.getIdsByLastName(GLOB['people'], lastname)
        return jsonify(**{'ids': data[0]})

if __name__ == '__main__':
    global GLOB
    
    parser = argparse.ArgumentParser()
    parser.add_argument("-d","--debug", help="Optional Debug Mode for stack traces", action="store_true")
    parser.add_argument("port", help="File to import data from", type=int)
    
    #since this is a web app the load data is required (should eventually load through a POST request
    parser.add_argument("file", help="File to import data from")
    args = parser.parse_args()
    
    # Make sure we have the data loaded before we continue
    data = people.loadData(args.file, args.debug)
    while data == None:
        args.file = utils.getInput('The file provided could not be found or opened please provide another csv file <-1 to exit>: ', str, None)
        if args.file == '-1':
            print 'Bye Bye'    
            sys.exit()
    
        data = people.loadData(args.file, args.debug)
        
    # Set up the app
    GLOB['people'] = data
    app.debug=args.debug
    app.run(host='0.0.0.0', port=args.port)
    
    
コード例 #3
0
ファイル: peopleTest.py プロジェクト: BobbyJohansen/CsvSort
 def test_loadData_With_UTF16(self):
     UTF16CSV = 'testutf16.csv'
     #code under test
     response = people.loadData(UTF16CSV)
     self.assertIsNotNone(response, 'Response was None Error Opening File for UTF-16')
     self.assertTrue(len(response[0].keys()) > 0 , 'No Keys returned for person object')