# Path: birdy/utils.py
# BINARY_MIMETYPES = [
#     "application/x-zipped-shp",
#     "application/vnd.google-earth.kmz",
#     "image/tiff; subtype=geotiff",
#     "image/tiff; application=geotiff",
#     "application/x-netcdf",
#     "application/octet-stream",
#     "application/zip",
#     "application/x-gzip",
#     "application/x-gtar",
#     "application/x-tgz",
# ]
# XML_MIMETYPES = ["application/xml", "application/gml+xml", "text/xml"]
# DEFAULT_ENCODING = "utf-8"
# def fix_url(url):
# def is_url(url):
# def is_opendap_url(url):
# def is_file(path):
# def sanitize(name):
# def delist(data):
# def embed(value, mimetype=None, encoding=None):
# def _encode(content, mimetype, encoding):
# def guess_type(url, supported):
# 
# Path: tests/common.py
# def resource_file(filepath):  # noqa: D103
#     return os.path.join(test_directory(), "resources", filepath)


import pytest
from pathlib import Path
from birdy import utils
from .common import resource_file
        from pathlib import Path
def test_delist():  # noqa: D103
    assert utils.delist(["one", "two"]) == ["one", "two"]
    assert utils.delist(["one"]) == "one"
    assert utils.delist("one") == "one"


class TestEncode:  # noqa: D101
    nc = resource_file("dummy.nc")
    xml = resource_file("wps_emu_caps.xml")

    def test_str(self):  # noqa: D102
        s = "just a string"
        assert utils.embed(s) == (s, "utf-8")

    def test_local_fn(self):  # noqa: D102
        nc, enc = utils.embed(self.nc, "application/x-netcdf")
        assert isinstance(nc, bytes)
        assert enc == "base64"

        xml, enc = utils.embed(self.xml, "text/xml")
        assert isinstance(xml, str)
        assert enc == "utf-8"

    def test_local_uri(self):  # noqa: D102
        xml, enc = utils.embed("file://" + self.xml, "text/xml")
        assert isinstance(xml, str)

    def test_path(self):  # noqa: D102
        p = Path(self.nc)


# Path: birdy/utils.py
# BINARY_MIMETYPES = [
#     "application/x-zipped-shp",
#     "application/vnd.google-earth.kmz",
#     "image/tiff; subtype=geotiff",
#     "image/tiff; application=geotiff",
#     "application/x-netcdf",
#     "application/octet-stream",
#     "application/zip",
#     "application/x-gzip",
#     "application/x-gtar",
#     "application/x-tgz",
# ]
# XML_MIMETYPES = ["application/xml", "application/gml+xml", "text/xml"]
# DEFAULT_ENCODING = "utf-8"
# def fix_url(url):
# def is_url(url):
# def is_opendap_url(url):
# def is_file(path):
# def sanitize(name):
# def delist(data):
# def embed(value, mimetype=None, encoding=None):
# def _encode(content, mimetype, encoding):
# def guess_type(url, supported):
# 
# Path: tests/common.py
# def resource_file(filepath):  # noqa: D103
#     return os.path.join(test_directory(), "resources", filepath)


# Path: tests/test_utils.py
import pytest
from pathlib import Path
from birdy import utils
from .common import resource_file
        from pathlib import Path

def test_delist():  # noqa: D103
    assert utils.delist(["one", "two"]) == ["one", "two"]
    assert utils.delist(["one"]) == "one"
    assert utils.delist("one") == "one"


class TestEncode:  # noqa: D101
    nc = resource_file("dummy.nc")
    xml = resource_file("wps_emu_caps.xml")

    def test_str(self):  # noqa: D102
        s = "just a string"
        assert utils.embed(s) == (s, "utf-8")

    def test_local_fn(self):  # noqa: D102
        nc, enc = utils.embed(self.nc, "application/x-netcdf")
        assert isinstance(nc, bytes)
        assert enc == "base64"

        xml, enc = utils.embed(self.xml, "text/xml")
        assert isinstance(xml, str)
        assert enc == "utf-8"

    def test_local_uri(self):  # noqa: D102
        xml, enc = utils.embed("file://" + self.xml, "text/xml")
        assert isinstance(xml, str)

    def test_path(self):  # noqa: D102
        p = Path(self.nc)


        nc, enc = utils.embed(p, "application/x-netcdf")