# Path: mapwidgets/widgets.py
# def minify_if_not_debug(asset):
#     def __init__(self, *args, **kwargs):
#     def map_options(self):
#     def media(self):
#     def render(self, name, value, attrs=None, renderer=None):
#     def media(self):
#     def render(self, name, value, attrs=None, renderer=None):
#     def get_js_widget_data(self, name, element_id):
#     def render(self, name, value, attrs=None, renderer=None):
#     def media(self):
#     def map_settings(self):  # pragma: no cover
#     def marker_settings(self):  # pragma: no cover
#     def get_template(self):  # pragma: no cover
#     def get_image_url(self, value):  # pragma: no cover
#     def get_context_data(self, name, value, attrs):
#     def render(self, name, value, attrs=None, renderer=None):
#     def __init__(self, zoom=None, size=None, *args, **kwargs):
#     def map_settings(self):
#     def marker_settings(self):
#     def get_point_field_params(self, latitude, longitude):
#     def get_image_url(self, value):
#     def __init__(self, zoom=None, size=None, thumbnail_size=None, *args, **kwargs):
#     def map_settings(self):
#     def get_thumbnail_url(self, value):
#     def get_context_data(self, name, value, attrs):
# class BasePointFieldMapWidget(BaseGeometryWidget):
# class GooglePointFieldWidget(BasePointFieldMapWidget):
# class MapboxPointFieldWidget(BasePointFieldMapWidget):
# class PointFieldInlineWidgetMixin(object):
# class GooglePointFieldInlineWidget(PointFieldInlineWidgetMixin, GooglePointFieldWidget):
# class BaseStaticMapWidget(forms.Widget):
# class GoogleStaticMapWidget(BaseStaticMapWidget):
# class GoogleStaticOverlayMapWidget(GoogleStaticMapWidget):
#     class Media:
# 
# Path: tests/testapp/widgets/tests/utils.py
# def html_escape(html):
#     """Return the given HTML with ampersands, quotes and carets encoded."""
#     return mark_safe(force_text(html).replace('&', '&amp;')
#                      .replace('<', '&lt;').replace('>', '&gt;')
#                      .replace('"', '&quot;').replace("'", '&#39;')
#                      )
# 
# def get_textarea_html(html_id, name, point):
#     point_value = point.wkt if point else ''
#     return '<textarea id="{html_id}" name="{name}">{point}</textarea>'.format(
#         html_id=html_id,
#         name=name,
#         point=point_value
#     )


import os
import json
    from importlib import reload as reload_module
    from imp import reload as reload_module
    from urllib.request import urlopen
    from http.client import HTTPMessage
    from urllib import urlopen
from django.test import TestCase
from django.test.utils import override_settings
from django.contrib.gis.geos import Point
from django.utils.html import escapejs
from django.conf import settings as test_app_settings
from django import forms as django_forms
from mapwidgets import widgets as mw_widgets
from .utils import html_escape, get_textarea_html
            Test widget with default settings which is defined in django settings file
        """
        zoom = 15
        default_map_center = [51.5073509, -0.12775829999]
        widget_settings = {
            "GooglePointFieldWidget": (
                ("zoom", zoom),
                ("mapCenterLocation", default_map_center),
            )
        }

        with override_settings(MAP_WIDGETS=widget_settings):
            reload_module(mw_widgets)
            widget = mw_widgets.GooglePointFieldInlineWidget()
            self.assertEqual(hasattr(widget, "settings"), True)
            self.assertEqual(hasattr(widget, "settings_namespace"), True)
            self.assertEqual(isinstance(widget.media, django_forms.Media), True)

            # test `map_options` method
            options_str = widget.map_options()
            options = json.loads(options_str)
            self.assertEqual(options.get("zoom"), zoom)
            self.assertEqual(options.get("mapCenterLocation"), default_map_center)

            # test render with Point object value
            point = Point(-104.9903, 39.73922, srid=DJANGO_DEFAULT_SRID_VALUE)
            widget_html_elem_id = "id_location"
            widget_html_elem_name = "location"
            result = widget.render(name=widget_html_elem_name, value=point, attrs={'id': widget_html_elem_id})
            self.assertIn(widget.serialize(point), result)

# Path: mapwidgets/widgets.py
# def minify_if_not_debug(asset):
#     def __init__(self, *args, **kwargs):
#     def map_options(self):
#     def media(self):
#     def render(self, name, value, attrs=None, renderer=None):
#     def media(self):
#     def render(self, name, value, attrs=None, renderer=None):
#     def get_js_widget_data(self, name, element_id):
#     def render(self, name, value, attrs=None, renderer=None):
#     def media(self):
#     def map_settings(self):  # pragma: no cover
#     def marker_settings(self):  # pragma: no cover
#     def get_template(self):  # pragma: no cover
#     def get_image_url(self, value):  # pragma: no cover
#     def get_context_data(self, name, value, attrs):
#     def render(self, name, value, attrs=None, renderer=None):
#     def __init__(self, zoom=None, size=None, *args, **kwargs):
#     def map_settings(self):
#     def marker_settings(self):
#     def get_point_field_params(self, latitude, longitude):
#     def get_image_url(self, value):
#     def __init__(self, zoom=None, size=None, thumbnail_size=None, *args, **kwargs):
#     def map_settings(self):
#     def get_thumbnail_url(self, value):
#     def get_context_data(self, name, value, attrs):
# class BasePointFieldMapWidget(BaseGeometryWidget):
# class GooglePointFieldWidget(BasePointFieldMapWidget):
# class MapboxPointFieldWidget(BasePointFieldMapWidget):
# class PointFieldInlineWidgetMixin(object):
# class GooglePointFieldInlineWidget(PointFieldInlineWidgetMixin, GooglePointFieldWidget):
# class BaseStaticMapWidget(forms.Widget):
# class GoogleStaticMapWidget(BaseStaticMapWidget):
# class GoogleStaticOverlayMapWidget(GoogleStaticMapWidget):
#     class Media:
# 
# Path: tests/testapp/widgets/tests/utils.py
# def html_escape(html):
#     """Return the given HTML with ampersands, quotes and carets encoded."""
#     return mark_safe(force_text(html).replace('&', '&amp;')
#                      .replace('<', '&lt;').replace('>', '&gt;')
#                      .replace('"', '&quot;').replace("'", '&#39;')
#                      )
# 
# def get_textarea_html(html_id, name, point):
#     point_value = point.wkt if point else ''
#     return '<textarea id="{html_id}" name="{name}">{point}</textarea>'.format(
#         html_id=html_id,
#         name=name,
#         point=point_value
#     )


# Path: tests/testapp/widgets/tests/test_widgets.py
import os
import json
    from importlib import reload as reload_module
    from imp import reload as reload_module
    from urllib.request import urlopen
    from http.client import HTTPMessage
    from urllib import urlopen
from django.test import TestCase
from django.test.utils import override_settings
from django.contrib.gis.geos import Point
from django.utils.html import escapejs
from django.conf import settings as test_app_settings
from django import forms as django_forms
from mapwidgets import widgets as mw_widgets
from .utils import html_escape, get_textarea_html

            Test widget with default settings which is defined in django settings file
        """
        zoom = 15
        default_map_center = [51.5073509, -0.12775829999]
        widget_settings = {
            "GooglePointFieldWidget": (
                ("zoom", zoom),
                ("mapCenterLocation", default_map_center),
            )
        }

        with override_settings(MAP_WIDGETS=widget_settings):
            reload_module(mw_widgets)
            widget = mw_widgets.GooglePointFieldInlineWidget()
            self.assertEqual(hasattr(widget, "settings"), True)
            self.assertEqual(hasattr(widget, "settings_namespace"), True)
            self.assertEqual(isinstance(widget.media, django_forms.Media), True)

            # test `map_options` method
            options_str = widget.map_options()
            options = json.loads(options_str)
            self.assertEqual(options.get("zoom"), zoom)
            self.assertEqual(options.get("mapCenterLocation"), default_map_center)

            # test render with Point object value
            point = Point(-104.9903, 39.73922, srid=DJANGO_DEFAULT_SRID_VALUE)
            widget_html_elem_id = "id_location"
            widget_html_elem_name = "location"
            result = widget.render(name=widget_html_elem_name, value=point, attrs={'id': widget_html_elem_id})
            self.assertIn(widget.serialize(point), result)

            self.assertIn(get_textarea_html(widget_html_elem_id, widget_html_elem_name, point), result)