예제 #1
0
def test_parse_twitter_description_01():
    """Ensure the Twitter description gets parsed correctly."""
    actual = parsing.parse_twitter_description(mock_data.twitter_description_01)
    expected = {
        Fields.CASE: '19-0161105',
    }
    assert actual == expected
예제 #2
0
def test_parse_twitter_description_number_deceased(input_, expected):
    """
    Test that the parser finds the right number of deceased people.
    """
    page_text = load_test_page(input_)
    twitter_description = regex.match_twitter_description_meta(page_text)
    d = parsing.parse_twitter_description(twitter_description)
    actual = len(d["Deceased"])
    assert actual == expected
예제 #3
0
def test_parse_twitter_description_without_notes():
    """
    Test that the parser finds the right number of deceased people.
    """
    twitter_description = ("'Case:         19-1321936 Date:          May 12, 2019 "
                           "Time:         11:34 p.m. Location:   12100 N. IH-35 NB Service road "
                           "Deceased:  First Middle Last, Black male, D.O.B. August 30, 1966'")
    d = parsing.parse_twitter_description(twitter_description)
    assert not d.get("D.O.B.")
    assert d["DOB"] == datetime.date(1966, 8, 30)
예제 #4
0
def test_parse_twitter_description_02():
    """Ensure a DOB recognized as a field can be parsed."""
    actual = parsing.parse_twitter_description(mock_data.twitter_description_02)
    expected = {
        'Case': '18-160882',
        'DOB': datetime.date(1961, 1, 22),
        'Date': datetime.date(2018, 1, 16),
        'Location': '1500 W. Slaughter Lane',
        'Time': datetime.time(17, 14),
    }
    if 'Deceased' in actual:
        del actual['Deceased']
    assert actual == expected
예제 #5
0
def test_parse_twitter_description_03():
    """Ensure a DOB recognized as a field can be parsed."""
    actual = parsing.parse_twitter_description(mock_data.twitter_description_03)
    expected = {}
    assert actual == expected
예제 #6
0
def test_parse_twitter_description_00(input_, expected):
    """Ensure the Twitter description gets parsed correctly."""
    actual = parsing.parse_twitter_description(input_)
    assert actual == expected