Пример #1
0
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"
Пример #2
0
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"
Пример #3
0
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
Пример #4
0
def test_to_datetime_aaaaa():
    expected = datetime(day=31, month=12, year=2018)
    date_string = '2018'
    assert to_datetime(date_string, 'pt') == expected
Пример #5
0
def test_to_datetime_mmm_aaaaa(date_string, language):
    expected = datetime(day=1, month=5, year=2018)
    assert to_datetime(date_string, language) == expected
Пример #6
0
    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",