Skip to content
Snippets Groups Projects
test_en.py 602 B
Newer Older
from src.detectors.date.en import detect_dates_en
from src.entity_types import EntityTypes


def test_detect_dates_en():
    # Check en-us
    text = "On 1.01.2022, I sold my cat. On April 5, 2021, I bought a dog."
    found_dates = detect_dates_en(text)

    assert found_dates == [(3, 12, EntityTypes.DATE), (32, 45, EntityTypes.DATE)]

    # Check en-gb
    # TODO: Following test fails. Fix it.
    # text = "On 1.01.2022 I sold the cat. On 5th April 2021 I bought a dog."
    # found_dates = detect_dates_en(text)

    # assert found_dates == [(3,12, EntityTypes.DATE), (32,46, EntityTypes.DATE)]