def test_search_by_code_portuguese(): code = 4 results = search_ts(code, Language.pt.value) metadata = results[0] assert metadata['name'] == "Ouro BM&F - grama" assert metadata['first_value'] == to_datetime("29/12/1989", "pt") assert metadata['frequency'] == "D"
def test_search_by_code_english(): code = 4 results = search_ts(code, Language.en.value) print(results) metadata = results[0] assert metadata['name'] == "BM&F Gold - gramme" assert metadata['first_value'] == to_datetime("29/12/1989", "en") assert metadata['frequency'] == "D"
def test_to_datetime_dd_mm_aaaaa(language): date_string = "01/01/2018" expected = datetime(day=1, month=1, year=2018) assert to_datetime(date_string, language) == expected
def test_to_datetime_aaaaa(): expected = datetime(day=31, month=12, year=2018) date_string = '2018' assert to_datetime(date_string, 'pt') == expected
def test_to_datetime_mmm_aaaaa(date_string, language): expected = datetime(day=1, month=5, year=2018) assert to_datetime(date_string, language) == expected
metadata = results[0] assert metadata['name'] == "Ouro BM&F - grama" assert metadata['first_value'] == to_datetime("29/12/1989", "pt") assert metadata['frequency'] == "D" @pytest.mark.search @pytest.mark.parametrize( "query,language,expected", [ ( 4, "pt", { "name": "Ouro BM&F - grama", "first_value": to_datetime("29/12/1989", "pt"), "freq": "D", }, ), ( 4, "en", { "name": "BM&F Gold - gramme", "first_value": to_datetime("29/12/1989", "en"), "freq": "D", }, ), ( 28209, "pt",