Exemple #1
0
def test_multiple_matches() -> None:
    res = lookup.query("Hafnarbraut 1")
    print(res)
    testing.assert_array_equal(res.postcode, [""])
    testing.assert_array_equal(res.municipality, [""])
    testing.assert_array_equal(res.house_nr, [""])
    testing.assert_array_equal(res.geometry, [None])
Exemple #2
0
def test_weird_cases(
    query: str, postcode: str, municipality: str, house_nr: str
) -> None:
    res = lookup.query(query)
    print(res)
    testing.assert_array_equal(res.postcode, [postcode])
    testing.assert_array_equal(res.municipality, [municipality])
    testing.assert_array_equal(res.house_nr, [house_nr])
Exemple #3
0
def test_missing_match_duplicate() -> None:
    df = pd.DataFrame(
        {"address": [
            "Funafold 95",
            "Funafold 95 ",
            "Funafold 95",
        ]})
    res = lookup.query(df.address.values)
    print(res)
    assert len(res) == 3
    testing.assert_array_equal(res.postcode.values, ["112", "112", "112"])
Exemple #4
0
def test_differently_formatted_duplicates() -> None:
    df = pd.DataFrame({
        "address": [
            "Funafold 95",
            "Funafold 95, 112",
            "Funafold 95, 112 Reykjavík",
        ]
    })
    res = lookup.query(df.address.values)
    print(res)
    assert len(res) == 3
    testing.assert_array_equal(res.postcode.values, ["112", "112", "112"])
Exemple #5
0
def test_edge_cases() -> None:
    res = lookup.query("Hagasmári 1, 201 Kópavogi")
    assert len(res) == 1
Exemple #6
0
def test_detect_duplicates(duplicates_dataframe: pd.DataFrame) -> None:
    res = lookup.query(duplicates_dataframe.address.values)
    print(res)
    assert len(res) == 3