def test_get_mandatos_municipais_soh_um(self): ini_date = parse_datetime('2009-10-10 0:0:0') fim_date = parse_datetime('2012-10-10 0:0:0') mandato_lists = utils.MandatoLists() mandatos = mandato_lists.get_mandatos(MUNICIPAL, ini_date, fim_date) self.assertEquals(len(mandatos), 1) self.assertEquals(mandatos[0].year, 2009)
def _test_get_mandatos_federais_ou_estaduais(self, esfera): ini_date = datetime.date(2008, 10, 10) fim_date = datetime.date(2015, 10, 10) mandato_lists = utils.MandatoLists() mandatos = mandato_lists.get_mandatos(esfera, ini_date, fim_date) self.assertEquals(len(mandatos), 3) self.assertEquals(mandatos[0].year, 2007) self.assertEquals(mandatos[1].year, 2011) self.assertEquals(mandatos[2].year, 2015) for mandato in mandatos: self.assertEquals(mandato.day, 1) self.assertEquals(mandato.month, 1)
def test_get_mandatos_municipais(self): ini_date = datetime.date(2008, 10, 10) fim_date = datetime.date(2013, 10, 10) mandato_lists = utils.MandatoLists() mandatos = mandato_lists.get_mandatos(MUNICIPAL, ini_date, fim_date) self.assertEquals(len(mandatos), 3) self.assertEquals(mandatos[0].year, 2005) self.assertEquals(mandatos[1].year, 2009) self.assertEquals(mandatos[2].year, 2013) for mandato in mandatos: self.assertEquals(mandato.day, 1) self.assertEquals(mandato.month, 1)
def test_get_just_one_municipal_mandate(self): # Start date of the mandate mandate_initial_date = parse_datetime('2009-10-10 0:0:0') # End date of the mandate mandate_final_date = parse_datetime('2012-10-10 0:0:0') # Lists of mandates mandate_lists = utils.MandatoLists() # Mandates that fall within a certain period (start date and end date) # in some of the spheres (municipal, state or federal) mandates = mandate_lists.get_mandates(MUNICIPAL, mandate_initial_date, mandate_final_date) self.assertEquals(len(mandates), 1) self.assertEquals(mandates[0].year, 2009)
def test_get_municipal_mandates(self): # Start date of the mandate mandate_initial_date = datetime.date(2008, 10, 10) # End date of the mandate mandate_final_date = datetime.date(2013, 10, 10) # Lists of mandates mandate_lists = utils.MandatoLists() # Mandates that fall within a certain period (start date and end date) # in some of the spheres (municipal, state or federal) mandates = mandate_lists.get_mandates(MUNICIPAL, mandate_initial_date, mandate_final_date) self.assertEquals(len(mandates), 3) self.assertEquals(mandates[0].year, 2005) self.assertEquals(mandates[1].year, 2009) self.assertEquals(mandates[2].year, 2013) for mandato in mandates: self.assertEquals(mandato.day, 1) self.assertEquals(mandato.month, 1)