Exemplo n.º 1
0
def search_counties():
    """Search the top counties"""

    tax = request.args.get("tax")

    if (request.args.get("state_id")):
        state_id = request.args.get("state_id")
        top_counties = ranking.counties_by_id(state_id, tax)
    # else:
    #     # top_counties = ranking.get_top_counties(tax, profession, mstatus, wl, wp, wc, wm, professionptn.strip())
    return jsonify(data=top_counties)
Exemplo n.º 2
0
def search_counties():
    """Search the top counties"""

    tax = request.args.get("tax")

    if (request.args.get("state_id")):
        state_id = request.args.get("state_id")
        top_counties = ranking.counties_by_id(state_id, tax)
    # else:
    #     # top_counties = ranking.get_top_counties(tax, profession, mstatus, wl, wp, wc, wm, professionptn.strip())
    return jsonify(data=top_counties)
Exemplo n.º 3
0
    def test_county_Texas(self):
        """ Test the function get_county_by_id with The case Texas """

        county_values = {'median_household_income': 58025, 'number_households': 411876,
                    'percapita_income': 33206, 'population': 1063248}
        state_id = "48"
        tax = "1ad"

        result = ranking.counties_by_id(state_id, tax)
        self.assert_valid_result(result)

        # tests if the returned list has 254 counties
        self.assertEqual(len(result), 254, "The list must have 254 item on it")
        for item in result:
            if (item['name'] == 'Travis'):
                # tests the values for the County of Platte
                self.assertEqual(item['median_household_income'], county_values['median_household_income'], "The median_household_income is different"+str(item['median_household_income'])+" - "+ str(county_values['median_household_income'])) 
                self.assertEqual(item['number_households'], county_values['number_households'], "The number_households is different"+str(item['number_households'])+" - "+ str(county_values['number_households'])) 
                self.assertEqual(item['percapita_income'], county_values['percapita_income'], "The percapita_income is different"+str(item['percapita_income'])+" - "+ str(county_values['percapita_income'])) 
                self.assertEqual(item['population'], county_values['population'], "The population is different"+str(item['population'])+" - "+ str(county_values['population'])) 
Exemplo n.º 4
0
    def test_county_Alabama(self):
        """ Test the function get_county_by_id with the case Alabama """

        county_values = {'median_household_income': 68770, 'number_households': 74144,
                    'percapita_income': 33313, 'population': 198366}
        state_id = "1"
        tax = "1ad"

        result = ranking.counties_by_id(state_id, tax)
        self.assert_valid_result(result)

        # tests if the returned list has 67 counties
        self.assertEqual(len(result), 67, "The list must have 67 item on it")

        for item in result:
            if (item['name'] == 'Shelby'):
                # tests the values for the County of Platte
                self.assertEqual(item['median_household_income'], county_values['median_household_income'], "The median_household_income is different"+str(item['median_household_income'])+" - "+ str(county_values['median_household_income'])) 
                self.assertEqual(item['number_households'], county_values['number_households'], "The number_households is different"+str(item['number_households'])+" - "+ str(county_values['number_households'])) 
                self.assertEqual(item['percapita_income'], county_values['percapita_income'], "The percapita_income is different"+str(item['percapita_income'])+" - "+ str(county_values['percapita_income'])) 
                self.assertEqual(item['population'], county_values['population'], "The population is different"+str(item['population'])+" - "+ str(county_values['population'])) 
Exemplo n.º 5
0
    def test_county_Missouri(self):
        """ Test the function get_county_by_id with the case Missouri """

        county_values = {'median_household_income': 67721, 'number_households': 36781,
                    'percapita_income': 35143, 'population': 90842}
        state_id = "29"
        tax = "1ad"

        result = ranking.counties_by_id(state_id, tax)
        self.assert_valid_result(result)

        # tests if the returned list has 115 counties
        self.assertEqual(len(result), 115, "The list must have 1115 item on it")

        for item in result:
            if (item['name'] == 'Platte'):
                # tests the values for the County of Platte
                self.assertEqual(item['median_household_income'], county_values['median_household_income'], "The median_household_income is different"+str(item['median_household_income'])+" - "+ str(county_values['median_household_income'])) 
                self.assertEqual(item['number_households'], county_values['number_households'], "The number_households is different"+str(item['number_households'])+" - "+ str(county_values['number_households'])) 
                self.assertEqual(item['percapita_income'], county_values['percapita_income'], "The percapita_income is different"+str(item['percapita_income'])+" - "+ str(county_values['percapita_income'])) 
                self.assertEqual(item['population'], county_values['population'], "The population is different"+str(item['population'])+" - "+ str(county_values['population']))