def test_row_starter(self): """ def row_starter(geo_type, obj): if geo_type == 'County': return [geo_type, obj.county.state.abbr, obj.county.name, "'{}'".format(obj.fips)] elif geo_type == 'MetroArea': return [geo_type, obj.msa.name, obj.fips] elif geo_type == 'State': return [geo_type, obj.state.name, "'{}'".format(obj.fips)] else: return [geo_type, obj.state.name, obj.fips] """ county_data = CountyMortgageData.objects.filter(fips='12081').first() county = county_data.county county_starter = row_starter('County', county_data) self.assertEqual( county_starter, ['County', county.state.abbr, county.name, "'{}'".format(county_data.fips)]) metro_data = MSAMortgageData.objects.filter(fips='35840').first() msa = metro_data.msa metro_starter = row_starter('MetroArea', metro_data) self.assertEqual( metro_starter, ['MetroArea', msa.name, metro_data.fips]) state_data = StateMortgageData.objects.filter(fips='12').first() state = state_data.state state_starter = row_starter('State', state_data) self.assertEqual( state_starter, ['State', state.name, "'{}'".format(state_data.fips)]) non_metro_data = NonMSAMortgageData.objects.get(fips='12-non') non_metro_starter = row_starter('NonMetroArea', non_metro_data) self.assertEqual( non_metro_starter, ['NonMetroArea', non_metro_data.state.name, non_metro_data.fips])