๓
๘ขTQc           @@ sฎ   d  d l  m Z m Z d  d l m Z d  d l m Z m Z d  d l m Z d  d l	 m
 Z
 m Z d  d l m Z d d l m Z m Z m Z m Z d	 e f d
     YZ d S(   i    (   t   absolute_importt   unicode_literals(   t   datetime(   t   no_mysqlt   no_spatialite(   t   render_to_kmz(   t   Countt   Min(   t   TestCasei   (   t   Cityt   PennsylvaniaCityt   Statet   Trutht   GeoRegressionTestsc           B@ sS   e  Z d    Z d   Z e e d     Z d   Z d   Z d   Z	 d   Z
 RS(   c         C@ sศ   t  j j d d  j } | j   } | j d 7_ | j d 7_ t  j j d d  j d |  |  j	 | t  j j d d  j  t  j j d d  j d |  |  j	 | t  j j d d  j  d S(   u)   Testing GeoQuerySet.update(). See #10411.t   nameu   Pueblog{ฎGแzt?t   pointN(
   R	   t   objectst   getR   t   clonet   yt   xt   filtert   updatet   assertEqual(   t   selft   pntt   bak(    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyt   test_update   s    "c         C@ s>   d } i | d 6| d 6d d 6g } t  d i | d 6 } d S(	   u8   Testing `render_to_kmz` with non-ASCII data. See #11624.u   รland Islandsu   nameu   descriptionu2   <Point><coordinates>5.0,23.0</coordinates></Point>u   kmlu   gis/kml/placemarks.kmlu   placesN(   R   (   R   R   t   placest   kmz(    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyt   test_kmz   s
    
c         C@ s   t  j j d d  j } | j | j | j | j f } t  j j d d  j   } x0 t | |  D] \ } } |  j	 | | d  qa Wd S(   u<   Testing `extent` on a table with a single point. See #11827.R   u   Puebloi   N(
   R	   R   R   R   R   R   R   t   extentt   zipt   assertAlmostEqual(   R   R   t   ref_extR   t   ref_valt   val(    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyt   test_extent%   s
    c      	   C@ s   t  d d d  } t j j d d d d d d	 d
 |  } |  j | t j j d d  d  |  j | t j j t d   d  d S(   uE   Testing dates are converted properly, even on SpatiaLite. See #16408.iA  i   i   R   u	   Mansfieldt   countyu   TiogaR   u   POINT(-77.071445 41.823881)t   foundedu   foundedu   dayi    u   founded__minN(   R   R
   R   t   createR   t   datest	   aggregateR   (   R   R'   t	   mansfield(    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyt   test_unicode_date/   s
    	#c         C@ s\   t  j j d d  } t j j d | j  } t  j j d |  } |  j | j   d  d S(   uH   Testing that PostGISAdapter.__eq__ does check empty strings. See #13670.R   u   Pueblot   poly__containst   id__ini   N(   R	   R   R   R   R   R   R   t   count(   R   t   pueblot   statet   cities_within_state(    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyt   test_empty_count7   s    c         C@ sf   |  j  t t j j t d   j d   t  |  j  t t j j t d   j d   t  d S(   uH   Regression for #16409. Make sure defer() and only() work with annotate()u   pointu   nameN(   t   assertIsInstancet   listR	   R   t   annotateR   t   defert   only(   R   (    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyt    test_defer_or_only_with_annotateA   s    1c         C@ s   t  j j d t  } t  j j d t  } t  j j d d  j } t  j j d d  j } |  j | t  |  j | t  |  j	 | t  |  j	 | t  d S(   uF   Testing Boolean value conversion with the spatial backend, see #15169.R$   t   pki   i   N(
   R   R   R(   t   Truet   FalseR   R$   R4   t   boolR   (   R   t   t1t   t2t   val1t   val2(    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyt   test_boolean_conversionF   s    (   t   __name__t
   __module__R   R   R   R   R%   R,   R3   R9   RB   (    (    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyR      s   						
	N(   t
   __future__R    R   R   t   django.contrib.gis.tests.utilsR   R   t   django.contrib.gis.shortcutsR   t   django.db.modelsR   R   t   django.testR   t   modelsR	   R
   R   R   R   (    (    (    sE   ../Django//lib/python/django/contrib/gis/tests/geoapp/test_regress.pyt   <module>   s   "