<commit_before>#! /usr/bin/env python import unittest

import numpy as np
import pytest
from pytest import approx

try:
    import ESMF
except ImportError:
    _WITH_ESMF = False
else:
    _WITH_ESMF = True
    from pymt.grids.esmp import (
        EsmpRasterField,
        EsmpRectilinear,
        EsmpUnstructured,
        EsmpUniformRectilinear,
        EsmpRectilinearField,
        DimensionError,
    )
    from pymt.grids.esmp import run_regridding


def setup():
    ESMF.Manager()


def test_2d_unstructured():
    g = EsmpUnstructured(
        [0, 1, 2, 0, 1, 2], [0, 0, 0, 1, 1, 1], [0, 1, 4, 3, 1, 2, 5, 4], [4, 8]<commit_msg>Skip module test if ESMF is not installed.<commit_after>#! /usr/bin/env python import unittest

import numpy as np
import pytest
from pytest import approx

try:
    import ESMF
except ImportError:
    _WITH_ESMF = False
else:
    _WITH_ESMF = True
    from pymt.grids.esmp import (
        EsmpRasterField,
        EsmpRectilinear,
        EsmpUnstructured,
        EsmpUniformRectilinear,
        EsmpRectilinearField,
        DimensionError,
    )
    from pymt.grids.esmp import run_regridding


esmf = pytest.importorskip("ESMF")


def setup():
    ESMF.Manager()


def test_2d_unstructured():
    g = EsmpUnstructured(
        [0, 1, 2, 0, 1, 2], [0, 0, 0, 1, 1, 1], [0, 1, 4, 3, 1, 2, 5, 4], [4, 8]
{'fraction_non_alphanumeric': 0.10208643815201192, 'fraction_numerical': 0.03427719821162444, 'mean_word_length': 2.7202216066481992, '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': '4087780', 'n_tokens_mistral': 552, 'n_tokens_neox': 496, 'n_words': 142}