<commit_before>from datetime import datetime, timezone
from pathlib import Path
from uuid import UUID

from affine import Affine
from shapely.geometry import shape

from eodatasets3 import DatasetDoc, Eo3Dict
from eodatasets3.model import GridDoc, MeasurementDoc, ProductDoc
from eodatasets3.prepare.esri_land_cover_prepare import as_eo3
from tests.common import assert_expected_eo3

ESRI_ANTIMERIDIAN_OVERLAP_TIF: Path = (
    Path(__file__).parent.parent / "data/esri-land-cover/60K_20200101-20210101.tif"
)


def test_esri_prepare():

    tif_url = ESRI_ANTIMERIDIAN_OVERLAP_TIF.resolve().as_uri()
    dataset_doc = as_eo3(tif_url)

    # Varies
    dataset_doc.properties.pop("odc:processing_datetime")

    assert_expected_eo3(
        DatasetDoc(
            id=UUID("411f3641-bc4a-501d-99e5-6c5c47379715"),
            product=ProductDoc("esri_land_cover"),
            accessories={},
            lineage={},
            label="esri_land_cover_60K_2020-01-01",
            locations=[
                "file:///home/jez/dea/eo-datasets/tests/integration/data/esri-land-cover/60K_20200101-20210101.tif",
            ],<commit_msg>Don't hard-code Jeremy's laptop in tests<commit_after>from datetime import datetime, timezone
from pathlib import Path
from uuid import UUID

from affine import Affine
from shapely.geometry import shape

from eodatasets3 import DatasetDoc, Eo3Dict
from eodatasets3.model import GridDoc, MeasurementDoc, ProductDoc
from eodatasets3.prepare.esri_land_cover_prepare import as_eo3
from tests.common import assert_expected_eo3

ESRI_ANTIMERIDIAN_OVERLAP_TIF: Path = (
    Path(__file__).parent.parent / "data/esri-land-cover/60K_20200101-20210101.tif"
)


def test_esri_prepare():

    tif_url = ESRI_ANTIMERIDIAN_OVERLAP_TIF.resolve().as_uri()
    dataset_doc = as_eo3(tif_url)

    # Varies
    dataset_doc.properties.pop("odc:processing_datetime")

    assert_expected_eo3(
        DatasetDoc(
            id=UUID("411f3641-bc4a-501d-99e5-6c5c47379715"),
            product=ProductDoc("esri_land_cover"),
            accessories={},
            lineage={},
            label="esri_land_cover_60K_2020-01-01",
            locations=[
                tif_url,
            ],
{'fraction_non_alphanumeric': 0.08880833710919801, 'fraction_numerical': 0.06252831898504757, 'mean_word_length': 3.53388090349076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3132230', 'n_tokens_mistral': 858, 'n_tokens_neox': 757, 'n_words': 127}