def ocorrencias_e_envolvidos(request): """ Return the render with the statistics from involved in the accident. """ involved_dao = EnvolvidosAcidentesDAO() involved_list = involved_dao.envolvidos_acidentes() medias, desvio = involved_dao.media_desvio_envolvidos() years = get_years_list(involved_list) year_average_list = zip(years, medias) response = render_to_response( "ocorrencias-e-envolvidos.html", {"lista_envolvidos": involved_list, "ano_media_list": year_average_list, "desvio": desvio}, context_instance=RequestContext(request), ) return response
class TestEnvolvidosAcidentes(DAO_Tests): """docstring for TestUF Class that tests the methods from envolvidos_acidentes_dao """ def test_envolvidos_acidentes(self): """ Tests to see if the method envolvidos_acidentes is correctly instantiated. @brief Local variables envolvidos_acidentes_list - Receives a list with the number involved in accidents. diffyears - Calculates the difference between years. """ self.dao = EnvolvidosAcidentesDAO() envolvidos_acidentes_list = self.dao.envolvidos_acidentes() self.assertIsNotNone(envolvidos_acidentes_list) diffyears = datetime.now().year - 2007 self.assertEquals(len(envolvidos_acidentes_list), diffyears) def test_media_desvio_envolvidos(self): """ Tests to see if the method media_desvio_envolvidos is correctly instantiated. @brief Local variables desvio - Receives a list with the number of involved in accidents. """ self.dao = EnvolvidosAcidentesDAO() lista_medias, desvio = self.dao.media_desvio_envolvidos() self.assertIsNotNone(lista_medias) self.assertIsNotNone(desvio)
def test_media_desvio_envolvidos(self): """ Tests to see if the method media_desvio_envolvidos is correctly instantiated. @brief Local variables desvio - Receives a list with the number of involved in accidents. """ self.dao = EnvolvidosAcidentesDAO() lista_medias, desvio = self.dao.media_desvio_envolvidos() self.assertIsNotNone(lista_medias) self.assertIsNotNone(desvio)
def test_envolvidos_acidentes(self): """ Tests to see if the method envolvidos_acidentes is correctly instantiated. @brief Local variables envolvidos_acidentes_list - Receives a list with the number involved in accidents. diffyears - Calculates the difference between years. """ self.dao = EnvolvidosAcidentesDAO() envolvidos_acidentes_list = self.dao.envolvidos_acidentes() self.assertIsNotNone(envolvidos_acidentes_list) diffyears = datetime.now().year - 2007 self.assertEquals(len(envolvidos_acidentes_list), diffyears)