import shapely
import geohash_polygon
from polygon_geohasher.polygon_geohasher import polygon_to_geohashes as polygon_to_geohashes_py

# def test_invalid():
#    assert geohash_polygon.polygon_to_geohashes("bouya", 3, True) == set()

def test_whitehorse():
    verdun_poly = shapely.from_wkt(open("tests/data/verdun_wkt.txt").read())
    whitehorse_poly = shapely.from_wkt(open("tests/data/whitehorse_wkt.txt").read())

    assert geohash_polygon.polygon_to_geohashes(whitehorse_poly, 6, False) == polygon_to_geohashes_py(whitehorse_poly, 6, False)
    assert geohash_polygon.polygon_to_geohashes(whitehorse_poly, 6, True) == polygon_to_geohashes_py(whitehorse_poly, 6, True)

def test_verdun():
    verdun_poly = shapely.from_wkt(open("tests/data/verdun_wkt.txt").read())

    assert geohash_polygon.polygon_to_geohashes(verdun_poly, 3, True) == set()
    assert geohash_polygon.polygon_to_geohashes(verdun_poly, 4, True) == set()
    assert geohash_polygon.polygon_to_geohashes(verdun_poly, 5, True) == set()

    assert geohash_polygon.polygon_to_geohashes(verdun_poly, 1, False) == {"f"}
    assert geohash_polygon.polygon_to_geohashes(verdun_poly, 4, False) == {"f25d"}
    assert geohash_polygon.polygon_to_geohashes(verdun_poly, 5, False) == {
        "f25dm",
        "f25dt",
        "f25dw",
    }

    assert geohash_polygon.polygon_to_geohashes(verdun_poly, 7, False) == {
        "f25dtej",
        "f25dtek",
        "f25dtyq",
        "f25dttp",
        "f25dwj3",
        "f25dt2g",
        "f25dtdt",
        "f25dtcd",
        "f25dtfy",
        "f25dw5c",
        "f25dtds",
        "f25dtyk",
        "f25dt9d",
        "f25dw4b",
        "f25dtvm",
        "f25dtce",
        "f25dt8h",
        "f25dw52",
        "f25dmrt",
        "f25dtg9",
        "f25dt8f",
        "f25dter",
        "f25dt0p",
        "f25dtgu",
        "f25dwj0",
        "f25dwhf",
        "f25dtse",
        "f25dtev",
        "f25dtf0",
        "f25dtg5",
        "f25dtv4",
        "f25dtb9",
        "f25dmr8",
        "f25dt8c",
        "f25dty4",
        "f25dt3t",
        "f25dt80",
        "f25dt93",
        "f25dt24",
        "f25dtsm",
        "f25dtgv",
        "f25dtsh",
        "f25dt87",
        "f25dwhg",
        "f25dtu9",
        "f25dt3x",
        "f25dt91",
        "f25dt2n",
        "f25dwh6",
        "f25dtu6",
        "f25dwjd",
        "f25dmx6",
        "f25dmx3",
        "f25dtvy",
        "f25dtdr",
        "f25dtvf",
        "f25dteu",
        "f25dtsw",
        "f25dt3p",
        "f25dw58",
        "f25dtus",
        "f25dt85",
        "f25dtuh",
        "f25dtfc",
        "f25dtew",
        "f25dt86",
        "f25dtsy",
        "f25dtuj",
        "f25dtvz",
        "f25dmxv",
        "f25dmpw",
        "f25dtd3",
        "f25dmrb",
        "f25dtem",
        "f25dtym",
        "f25dtfj",
        "f25dtg2",
        "f25dtgq",
        "f25dmxb",
        "f25dwje",
        "f25dtfx",
        "f25dtdv",
        "f25dtd2",
        "f25dtgz",
        "f25dtss",
        "f25dtsu",
        "f25dt27",
        "f25dtcg",
        "f25dt84",
        "f25dmry",
        "f25dt9v",
        "f25dwh2",
        "f25dmrk",
        "f25dt2t",
        "f25dtfu",
        "f25dty6",
        "f25dt6p",
        "f25dtey",
        "f25dtun",
        "f25dw59",
        "f25dtsg",
        "f25dtg6",
        "f25dt2p",
        "f25dmrf",
        "f25dtub",
        "f25dwhd",
        "f25dty7",
        "f25dtv6",
        "f25dt9z",
        "f25dtf8",
        "f25dtur",
        "f25dwhb",
        "f25dt3k",
        "f25dt9n",
        "f25dt35",
        "f25dmrd",
        "f25dt88",
        "f25dtug",
        "f25dtg4",
        "f25dtvp",
        "f25dtsp",
        "f25dmrx",
        "f25dtvt",
        "f25dtbb",
        "f25dtex",
        "f25dtdu",
        "f25dtuf",
        "f25dt9w",
        "f25dtu7",
        "f25dtyn",
        "f25dtvj",
        "f25dwh5",
        "f25dtgp",
        "f25dmxf",
        "f25dt8r",
        "f25dtc2",
        "f25dt3r",
        "f25dw50",
        "f25dtvh",
        "f25dtfr",
        "f25dt21",
        "f25dtbf",
        "f25dmxs",
        "f25dmrr",
        "f25dtfh",
        "f25dtcy",
        "f25dmrw",
        "f25dt22",
        "f25dt96",
        "f25dtd0",
        "f25dtvq",
        "f25dmx8",
        "f25dmrq",
        "f25dw53",
        "f25dtue",
        "f25dtf1",
        "f25dte5",
        "f25dtfv",
        "f25dt98",
        "f25dwjm",
        "f25dt9y",
        "f25dtvr",
        "f25dwj7",
        "f25dtft",
        "f25dtsj",
        "f25dtcc",
        "f25dtyp",
        "f25dmr7",
        "f25dtdx",
        "f25dw5b",
        "f25dwj8",
        "f25dmx7",
        "f25dtvk",
        "f25dtg3",
        "f25dtsr",
        "f25dmxu",
        "f25dts7",
        "f25dtdk",
        "f25dtc6",
        "f25dttj",
        "f25dwjs",
        "f25dtcf",
        "f25dwjc",
        "f25dwj6",
        "f25dt9g",
        "f25dt3m",
        "f25dtd6",
        "f25dtfz",
        "f25dwh7",
        "f25dwjg",
        "f25dt29",
        "f25dtct",
        "f25dtu3",
        "f25dw51",
        "f25dwj5",
        "f25dt94",
        "f25dt3j",
        "f25dtgt",
        "f25dtc7",
        "f25dt8q",
        "f25dw48",
        "f25dw5g",
        "f25dwj2",
        "f25dtu0",
        "f25dwh1",
        "f25dtv5",
        "f25dt2z",
        "f25dt3q",
        "f25dtfg",
        "f25dt8s",
        "f25dtuy",
        "f25dtud",
        "f25dtuw",
        "f25dt90",
        "f25dt92",
        "f25dmre",
        "f25dt3z",
        "f25dwh3",
        "f25dt9k",
        "f25dtgh",
        "f25dtc9",
        "f25dtf3",
        "f25dtdh",
        "f25dtfm",
        "f25dtv7",
        "f25dt8z",
        "f25dmx9",
        "f25dtb2",
        "f25dtd1",
        "f25dt8y",
        "f25dt2w",
        "f25dtfb",
        "f25dtf9",
        "f25dtsn",
        "f25dtvv",
        "f25dt2y",
        "f25dw54",
        "f25dwhe",
        "f25dtvn",
        "f25dtfe",
        "f25dtck",
        "f25dtc1",
        "f25dmxg",
        "f25dtfk",
        "f25dw5d",
        "f25dt8m",
        "f25dmru",
        "f25dtbc",
        "f25dt2x",
        "f25dty5",
        "f25dtut",
        "f25dt2q",
        "f25dtcs",
        "f25dtuc",
        "f25dtgn",
        "f25dtu5",
        "f25dwh9",
        "f25dtdg",
        "f25dteh",
        "f25dt2m",
        "f25dtsz",
        "f25dtgj",
        "f25dtgb",
        "f25dt2d",
        "f25dmxd",
        "f25dteq",
        "f25dtu8",
        "f25dtgs",
        "f25dt2h",
        "f25dtdm",
        "f25dtu2",
        "f25dtum",
        "f25dwjb",
        "f25dt9b",
        "f25dt2r",
        "f25dtvs",
        "f25dwjf",
        "f25dtg8",
        "f25dmrm",
        "f25dtvw",
        "f25dt9e",
        "f25dwhc",
        "f25dt26",
        "f25dtg7",
        "f25dwh8",
        "f25dtuv",
        "f25dt2u",
        "f25dtgc",
        "f25dwj1",
        "f25dtuu",
        "f25dt97",
        "f25dtdw",
        "f25dtez",
        "f25dt8x",
        "f25dtdp",
        "f25dtcu",
        "f25dwn0",
        "f25dw4c",
        "f25dtd5",
        "f25dtf2",
        "f25dtg1",
        "f25dt9h",
        "f25dw56",
        "f25dtdn",
        "f25dtb8",
        "f25dt3w",
        "f25dtf7",
        "f25dtgm",
        "f25dt25",
        "f25dt2s",
        "f25dmrs",
        "f25dtfs",
        "f25dtyj",
        "f25dtde",
        "f25dt8k",
        "f25dtgx",
        "f25dtfn",
        "f25dt9m",
        "f25dtf4",
        "f25dwj4",
        "f25dtf5",
        "f25dwj9",
        "f25dt99",
        "f25dw5e",
        "f25dt81",
        "f25dmr6",
        "f25dt23",
        "f25dtge",
        "f25dtst",
        "f25dtgg",
        "f25dtdq",
        "f25dt9c",
        "f25dtdj",
        "f25dtgw",
        "f25dtc8",
        "f25dmr9",
        "f25dt8e",
        "f25dtc3",
        "f25dt8t",
        "f25dt2k",
        "f25dwjt",
        "f25dwjk",
        "f25dtu1",
        "f25dmrv",
        "f25dten",
        "f25dmxe",
        "f25dtd4",
        "f25dt82",
        "f25dt8d",
        "f25dtup",
        "f25dt9s",
        "f25dtvg",
        "f25dtc5",
        "f25dt8j",
        "f25dtd7",
        "f25dt9j",
        "f25dt3h",
        "f25dt9r",
        "f25dtuk",
        "f25dt8w",
        "f25dtdd",
        "f25dt2v",
        "f25dt9u",
        "f25dtep",
        "f25dt8v",
        "f25dt83",
        "f25dw5f",
        "f25dtgk",
        "f25dt95",
        "f25dt8b",
        "f25dtsx",
        "f25dtvu",
        "f25dtu4",
        "f25dt2f",
        "f25dtg0",
        "f25dtgd",
        "f25dtdy",
        "f25dt2e",
        "f25dmxc",
        "f25dtdz",
        "f25dtsv",
        "f25dtyh",
        "f25dtcv",
        "f25dtuz",
        "f25dmrz",
        "f25dtf6",
        "f25dmrg",
        "f25dtfp",
        "f25dtvx",
        "f25dmx0",
        "f25dtes",
        "f25dt9p",
        "f25dtsq",
        "f25dt9t",
        "f25dtet",
        "f25dtfw",
        "f25dt9q",
        "f25dtsk",
        "f25dw42",
        "f25dtgf",
        "f25dt3y",
        "f25dwh4",
        "f25dtvd",
        "f25dtcb",
        "f25dmx4",
        "f25dtfd",
        "f25dtgy",
        "f25dt9x",
        "f25dtux",
        "f25dtve",
        "f25dmx2",
        "f25dtgr",
        "f25dtfq",
        "f25dt8n",
        "f25dwh0",
        "f25dt20",
        "f25dt8g",
        "f25dmx1",
        "f25dt89",
        "f25dmpx",
        "f25dtc4",
        "f25dt9f",
        "f25dtff",
        "f25dt2j",
        "f25dmpz",
        "f25dt8u",
        "f25dmrc",
        "f25dtuq",
        "f25dttn",
        "f25dt3n",
        "f25dtc0",
    }
