
D()Qc           @   s  d  Z  d d l Z d d l Z d d l m Z d d l m Z d d l m Z d a
 e j j e j j e e j   d d  Z d   Z d	   Z d
   Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d S(   sj   
This module has the mock object definitions used to hold reference geometry
for the GEOS and GDAL tests.
iN(   t   gis(   t   six(   t   upatht   testst   datac         C   s<   t  |  t t f  r8 t g  |  D] } t |  ^ q  S|  S(   s6   Turn all nested sequences to tuples in given sequence.(   t
   isinstancet   listt   tuplet   tuplize(   t   seqt   i(    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR      s    #c         C   s8   t  g  t j |   D] \ } } t |  | f ^ q  S(   s,   Converts all keys in dictionary to str type.(   t   dictR   t	   iteritemst   str(   t   dt   kt   v(    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyt
   strconvert   s    c         C   s   t  j j t |  |  d |  S(   Ns   .%s(   t   ost   patht   joint	   TEST_DATA(   t   namet   ext(    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyt   get_ds_file    s    t   TestObjc           B   s   e  Z d  Z d   Z RS(   sB   
    Base testing object, turns keyword args into attributes.
    c         K   s1   x* | j    D] \ } } t |  | |  q Wd  S(   N(   t   itemst   setattr(   t   selft   kwargst   keyt   value(    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyt   __init__+   s    (   t   __name__t
   __module__t   __doc__R    (    (    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR   '   s   t   TestDSc           B   s   e  Z d  Z d   Z RS(   s/   
    Object for testing GDAL data sources.
    c         K   s>   | j  d d  } t | |  |  _ t t |   j |   d  S(   NR   t   shp(   t   popR   t   dst   superR$   R    (   R   R   R   R   (    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR    4   s    (   R!   R"   R#   R    (    (    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR$   0   s   t   TestGeomc           B   s   e  Z d  Z d   Z RS(   sZ   
    Testing object used for wrapping reference geometry data
    in GEOS/GDAL tests.
    c         K   s   | j  d d   } | r* t |  |  _ n  | j  d d   } | rT t |  |  _ n  | j  d d   } | r{ t |  } n  | |  _ t t |   j	 |   d  S(   Nt   coordst   centroidt   ext_ring_cs(
   R&   t   NoneR   R*   R   R+   R,   R(   R)   R    (   R   R   R*   R+   R,   (    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR    @   s    	(   R!   R"   R#   R    (    (    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR)   ;   s   t   TestGeomSetc           B   s   e  Z d  Z d   Z RS(   sJ   
    Each attribute of this object is a list of `TestGeom` instances.
    c      	   K   sP   xI | j    D]; \ } } t |  | g  | D] } t t |    ^ q)  q Wd  S(   N(   R   R   R)   R   (   R   R   R   R   t   kw(    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR    X   s    (   R!   R"   R#   R    (    (    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR.   T   s   t   TestDataMixinc           B   s   e  Z d  Z e d    Z RS(   s   
    Mixin used for GEOS/GDAL test cases that defines a `geometries`
    property, which returns and/or loads the reference geometry data.
    c         C   sX   t  d  k rT t t j j t d    } t j |  } Wd  QXt	 t
 |    a  n  t  S(   Ns   geometries.json(   t
   GEOMETRIESR-   t   openR   R   R   R   t   jsont   loadR.   R   (   R   t   ft
   geometries(    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR6   b   s
    (   R!   R"   R#   t   propertyR6   (    (    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyR0   ]   s   (   R#   R3   R   t   django.contribR    t   django.utilsR   t   django.utils._osR   R-   R1   R   R   t   dirnamet   __file__R   R   R   R   t   objectR   R$   R)   R.   R0   (    (    (    s>   ../Django//lib/python/django/contrib/gis/geometry/test_data.pyt   <module>   s   -					