def test_pertenencia(N, provinces): for province in provinces: muestra = g08.generar_muestra_provincia(N // 4, province) for persona in muestra: assert (persona[32] == province)
def test_provincia_100(N, indicators): g08.testing = True g08.riggedRandom = 100 muestra = g08.generar_muestra_provincia(N, "CARTAGO") for i in range(len(indicators)): assert (g08.show_percentages_indicator(muestra, indicators[i]) == 1.0)
def test_provincia_90(N, indicators, r): g08.testing = True g08.riggedRandom = 90 muestra = g08.generar_muestra_provincia(N, "HEREDIA") for i in range(len(indicators)): assert (0.9 - r < g08.show_percentages_indicator( muestra, indicators[i]) < 0.9 + r)
def test_provincia_50(N, indicators, r): g08.testing = True g08.riggedRandom = 50 muestra = g08.generar_muestra_provincia(N, "ALAJUELA") for i in range(len(indicators)): assert (0.5 - r < g08.show_percentages_indicator( muestra, indicators[i]) < 0.5 + r)
def averge(n): corridas_pais = [] result = [] keys = [] for i in range(10): if actual!="Pais": keys, values = show_percentages(generar_muestra_provincia(n, actual.upper())) elif actual=="Pais": keys, values = show_percentages(generar_muestra_pais(n)) corridas_pais.append(values) corridas_pais = average_aux(corridas_pais) return keys, corridas_pais
def gen_dataset(n, provincia, sample_type=1): """ Generates the working dataset """ result = None if provincia != "PAIS": result = g08.generar_muestra_provincia(n,provincia,sample_type) else: result = g08.generar_muestra_pais(n,sample_type) return result