# Path: upoints/kml.py
# KML_NS = 'http://earth.google.com/kml/2.2'
# class Placemark(trigpoints.Trigpoint):
# class Placemarks(point.KeyedPoints):
#     def __init__(
#         self, latitude, longitude, altitude=None, name=None, description=None
#     ):
#     def __str__(self):
#     def tokml(self):
#     def __init__(self, kml_file=None):
#     def import_locations(self, kml_file):
#     def export_kml_file(self):
# 
# Path: tests/utils.py
# def xml_compare(elem1, elem2, ellipsis=False):
#     """Compare XML elements
# 
#     Args:
#         ellipsis (bool): Support ellipsis for 'any' match
# 
#     Raises:
#         ValueError: On mismatch in ellipsised text
#     """
#     assert elem1.tag == elem2.tag
#     for key, value in elem1.attrib.items():
#         assert elem2.attrib.get(key) == value
#     for key in elem2.attrib.keys():
#         assert key in elem1.attrib
#     text1 = elem1.text.strip() if elem1.text else ''
#     text2 = elem2.text.strip() if elem2.text else ''
#     tail1 = elem1.tail.strip() if elem1.tail else ''
#     tail2 = elem2.tail.strip() if elem2.tail else ''
#     if ellipsis:
#         if not ellipsis_match(text1, text2):
#             raise ValueError(
#                 f'text mismatch: {elem1.text!r} != {elem2.text!r}'
#             )
#         if not ellipsis_match(tail1, tail2):
#             raise ValueError(
#                 f'tail mismatch: {elem1.tail!r} != {elem2.tail!r}'
#             )
#     else:
#         assert text1 == text2
#         assert tail1 == tail2
#     children1 = elem1.getchildren()
#     children2 = elem2.getchildren()
#     assert len(children1) == len(children2)
#     for child1, child2 in zip(children1, children2):
#         xml_compare(child1, child2, ellipsis)


from pytest import mark
from upoints.kml import Placemark, Placemarks, etree
from tests.utils import xml_compare
            ),
            (
                (52, 0, 4, 'Cambridge', 'in the UK'),
                b'<kml:Placemark xmlns:kml="http://earth.google.com/kml/2.2" id="Cambridge">'
                b'<kml:name>Cambridge</kml:name><kml:description>in the UK</kml:description>'
                b'<kml:Point><kml:coordinates>0.0,52.0,4</kml:coordinates></kml:Point>'
                b'</kml:Placemark>',
            ),
        ],
    )
    def test_tokml(self, args, result):
        assert etree.tostring(Placemark(*args).tokml()) == result


class TestPlacemarks:
    @mark.parametrize(
        'name, result',
        [
            ('Cambridge', 'Cambridge (52°10′01″N, 000°23′24″E)'),
            ('Home', 'Home (52°00′54″N, 000°13′15″W alt 60m)'),
        ],
    )
    def test_import_locations(self, name, result):
        with open('tests/data/kml') as f:
            locations = Placemarks(f)
        assert str(locations[name]) == result

    def test_export_kml_file(self):
        filename = 'tests/data/kml'
        with open(filename) as f:

# Path: upoints/kml.py
# KML_NS = 'http://earth.google.com/kml/2.2'
# class Placemark(trigpoints.Trigpoint):
# class Placemarks(point.KeyedPoints):
#     def __init__(
#         self, latitude, longitude, altitude=None, name=None, description=None
#     ):
#     def __str__(self):
#     def tokml(self):
#     def __init__(self, kml_file=None):
#     def import_locations(self, kml_file):
#     def export_kml_file(self):
# 
# Path: tests/utils.py
# def xml_compare(elem1, elem2, ellipsis=False):
#     """Compare XML elements
# 
#     Args:
#         ellipsis (bool): Support ellipsis for 'any' match
# 
#     Raises:
#         ValueError: On mismatch in ellipsised text
#     """
#     assert elem1.tag == elem2.tag
#     for key, value in elem1.attrib.items():
#         assert elem2.attrib.get(key) == value
#     for key in elem2.attrib.keys():
#         assert key in elem1.attrib
#     text1 = elem1.text.strip() if elem1.text else ''
#     text2 = elem2.text.strip() if elem2.text else ''
#     tail1 = elem1.tail.strip() if elem1.tail else ''
#     tail2 = elem2.tail.strip() if elem2.tail else ''
#     if ellipsis:
#         if not ellipsis_match(text1, text2):
#             raise ValueError(
#                 f'text mismatch: {elem1.text!r} != {elem2.text!r}'
#             )
#         if not ellipsis_match(tail1, tail2):
#             raise ValueError(
#                 f'tail mismatch: {elem1.tail!r} != {elem2.tail!r}'
#             )
#     else:
#         assert text1 == text2
#         assert tail1 == tail2
#     children1 = elem1.getchildren()
#     children2 = elem2.getchildren()
#     assert len(children1) == len(children2)
#     for child1, child2 in zip(children1, children2):
#         xml_compare(child1, child2, ellipsis)


# Path: tests/test_kml.py
from pytest import mark
from upoints.kml import Placemark, Placemarks, etree
from tests.utils import xml_compare

            ),
            (
                (52, 0, 4, 'Cambridge', 'in the UK'),
                b'<kml:Placemark xmlns:kml="http://earth.google.com/kml/2.2" id="Cambridge">'
                b'<kml:name>Cambridge</kml:name><kml:description>in the UK</kml:description>'
                b'<kml:Point><kml:coordinates>0.0,52.0,4</kml:coordinates></kml:Point>'
                b'</kml:Placemark>',
            ),
        ],
    )
    def test_tokml(self, args, result):
        assert etree.tostring(Placemark(*args).tokml()) == result


class TestPlacemarks:
    @mark.parametrize(
        'name, result',
        [
            ('Cambridge', 'Cambridge (52°10′01″N, 000°23′24″E)'),
            ('Home', 'Home (52°00′54″N, 000°13′15″W alt 60m)'),
        ],
    )
    def test_import_locations(self, name, result):
        with open('tests/data/kml') as f:
            locations = Placemarks(f)
        assert str(locations[name]) == result

    def test_export_kml_file(self):
        filename = 'tests/data/kml'
        with open(filename) as f:

            locations = Placemarks(f)