Ejemplo n.º 1
0
 def test_test_restaurant_grades(self):
     gh = gradeHelper('DOHMH_New_York_City_Restaurant_Inspection_Results.csv')
     self.assertEqual(0, gh.test_restaurant_grades(30075445))
     pass
Ejemplo n.º 2
0
assignment10.py

Created on Dec 2, 2015

@author: rjw366
'''
import matplotlib.pyplot as plt
import numpy as np
from gradeHelper import gradeHelper
import sys
from collections import Counter

if __name__ == '__main__':
    try:
        #Checks to make sure the file is in correct location
        gh = gradeHelper('DOHMH_New_York_City_Restaurant_Inspection_Results.csv')
    except IOError:
        print('File was not found, exiting program')
        sys.exit(1)
    #Only user related action. If it passes no other exception handling is needed
    
    boroughs = gh.df['BORO'].unique()
    allGrades = []
    nyScore = 0
    for boro in boroughs:
        #Utilize function to calculate grades per boro
        grades_per_boro = list(map(gh.test_restaurant_grades, gh.df[gh.df['BORO'] == boro]['CAMIS'].unique()))
        unique = [-1,0,1]
        count = [0,0,0]
        sumBoroGrades=0
        if(boro != "Missing"):
Ejemplo n.º 3
0
 def test_test_grades(self):
     gh = gradeHelper('DOHMH_New_York_City_Restaurant_Inspection_Results.csv')
     self.assertEqual(0, gh.test_grades(['A', 'B', 'A']))
     self.assertEqual(-1, gh.test_grades(['A', 'B', 'C']))
     self.assertEqual(1, gh.test_grades(['C', 'B', 'A']))
     pass