From 39e587e19aad821c2059f12c1c591e2108e58166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=A3=20Bida=20Vacaro?= Date: Tue, 12 Dec 2023 15:59:32 -0300 Subject: [PATCH] Enabel ibge tests --- pysus/tests/test_decoders.py | 2 +- .../tests/test_ftp/test_databases/test_CIHA.py | 4 ++-- pysus/tests/test_ftp/test_databases/test_SIH.py | 6 +++--- pysus/tests/test_ibge.py | 17 +++++++---------- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/pysus/tests/test_decoders.py b/pysus/tests/test_decoders.py index d7c0b92..43bc4db 100644 --- a/pysus/tests/test_decoders.py +++ b/pysus/tests/test_decoders.py @@ -121,7 +121,7 @@ def test_group_and_count(self): ) self.assertGreater(sum(sample), 0) - @pytest.mark.timeout(60) + @pytest.mark.timeout(120) def test_redistribute(self): df = download(groups="cid10", states="sp", years=2010).to_dataframe() df = decoders.translate_variables_SIM( diff --git a/pysus/tests/test_ftp/test_databases/test_CIHA.py b/pysus/tests/test_ftp/test_databases/test_CIHA.py index a47e6bd..d2dcbd7 100644 --- a/pysus/tests/test_ftp/test_databases/test_CIHA.py +++ b/pysus/tests/test_ftp/test_databases/test_CIHA.py @@ -50,7 +50,7 @@ def test_ciha(self): 'pysus.ftp.databases.ciha.CIHA', return_value=MagicMock(__content__=mock_content) ) as mock_ciha: - ciha = CIHA().load() + ciha = CIHA() ciha.__content__ = mock_ciha().__content__ descriptions = [ciha.describe(file) for file in ciha.files] @@ -89,6 +89,6 @@ def test_ciha(self): self.assertEqual(formats, expected_formats) get_files = ciha.get_files( - uf='AC', year=2011, month=12 + uf='AC', year=2011, month=1 ) self.assertEqual(get_files, [ciha.files[0]]) diff --git a/pysus/tests/test_ftp/test_databases/test_SIH.py b/pysus/tests/test_ftp/test_databases/test_SIH.py index f37ba70..e044c75 100644 --- a/pysus/tests/test_ftp/test_databases/test_SIH.py +++ b/pysus/tests/test_ftp/test_databases/test_SIH.py @@ -15,7 +15,7 @@ class TestSIHDatabase(unittest.TestCase): - def test_sim(self): + def test_sih(self): mock_content = { "CHBR1901.dbc": File( path="/dissemin/publicos/SIHSUS/200801_/Dados/CHBR1901.dbc", @@ -26,9 +26,9 @@ def test_sim(self): 'modify': datetime.datetime(2020, 3, 10, 14, 43) } ), - "DOAC1997.dbc": File( + "CHBR1902.dbc": File( path="/dissemin/publicos/SIHSUS/200801_/Dados/CHBR1902.dbc", - name="DOAC1997.dbc", + name="CHBR1902.dbc", info={ 'size': 196287, 'type': 'file', diff --git a/pysus/tests/test_ibge.py b/pysus/tests/test_ibge.py index ef2a124..3c725b4 100644 --- a/pysus/tests/test_ibge.py +++ b/pysus/tests/test_ibge.py @@ -4,43 +4,40 @@ import pandas as pd from pysus.online_data import IBGE + class SIDRA(unittest.TestCase): - @pytest.mark.skip(reason="This test takes too long") - @pytest.mark.timeout(5) + @pytest.mark.timeout(120) def test_get_aggregates(self): df = IBGE.list_agregados() self.assertIsInstance(df, pd.DataFrame) self.assertGreater(df.size, 0) - @pytest.mark.timeout(5) + @pytest.mark.timeout(120) def test_localidades_por_agregado(self): df = IBGE.localidades_por_agregado(475, nivel='N3') self.assertIsInstance(df, pd.DataFrame) self.assertGreater(df.size, 0) - @pytest.mark.skip(reason="This test takes too long") - @pytest.mark.timeout(5) + @pytest.mark.timeout(120) def test_lista_periodos(self): df = IBGE.lista_periodos(475) self.assertIsInstance(df, pd.DataFrame) self.assertGreater(df.size, 0) - @pytest.mark.timeout(5) + @pytest.mark.timeout(120) def test_get_sidra_table(self): df = IBGE.get_sidra_table(200, territorial_level=6, geocode=4220000, period='last', classification=2, categories='all') self.assertIsInstance(df, pd.DataFrame) self.assertGreater(df.size, 0) - @pytest.mark.skip(reason="This test takes too long") - @pytest.mark.timeout(5) + @pytest.mark.timeout(120) def test_metadata(self): md = IBGE.metadados(475) self.assertIsInstance(md, dict) self.assertGreater(len(md), 0) - @pytest.mark.skip(reason="This test takes too long") - @pytest.mark.timeout(5) + @pytest.mark.timeout(120) def test_FetchData(self): ds = IBGE.FetchData(475, periodos=1996, variavel=93, localidades='N3[all]', classificacao='58[all]|2[4,5]|1[all]', view='flat')