Skip to content

Commit

Permalink
Enabel ibge tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luabida committed Dec 12, 2023
1 parent fe019ba commit 39e587e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pysus/tests/test_decoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions pysus/tests/test_ftp/test_databases/test_CIHA.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]])
6 changes: 3 additions & 3 deletions pysus/tests/test_ftp/test_databases/test_SIH.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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',
Expand Down
17 changes: 7 additions & 10 deletions pysus/tests/test_ibge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 39e587e

Please sign in to comment.