
X\Qc           @   s  d  d l  Z  d  d l Z d e j f d     YZ d   Z d e j f d     YZ d e  j f d     YZ	 d	 e  j f d
     YZ
 d e  j f d     YZ d e  j f d     YZ d e  j f d     YZ d e  j f d     YZ d   Z d   Z e d k re   n  d S(   iNt   MyConnectionc           B   s   e  Z d    Z RS(   c         O   s   t  j j |  | |  d  S(   N(   t   sqlitet
   Connectiont   __init__(   t   selft   argst   kwargs(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR      s    (   t   __name__t
   __module__R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR       s   c         C   s<   i  } x/ t  |  j  D] \ } } | | | | d <q W| S(   Ni    (   t	   enumeratet   description(   t   cursort   rowt   dt   idxt   col(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   dict_factory   s    t   MyCursorc           B   s   e  Z d    Z RS(   c         O   s#   t  j j |  | |  t |  _ d  S(   N(   R   t   CursorR   R   t   row_factory(   R   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   &   s    (   R   R   R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   %   s   t   ConnectionFactoryTestsc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   t  j d d t |  _ d  S(   Ns   :memory:t   factory(   R   t   connectR    t   con(   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   setUp+   s    c         C   s   |  j  j   d  S(   N(   R   t   close(   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   tearDown.   s    c         C   s    |  j  t |  j t  d  d  S(   Ns*   connection is not instance of MyConnection(   t
   assertTruet
   isinstanceR   R    (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckIsInstance1   s    (   R   R   R   R   R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   *   s   		t   CursorFactoryTestsc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   t  j d  |  _ d  S(   Ns   :memory:(   R   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   7   s    c         C   s   |  j  j   d  S(   N(   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   :   s    c         C   s2   |  j  j d t  } |  j t | t  d  d  S(   NR   s"   cursor is not instance of MyCursor(   R   R   R   R   R   (   R   t   cur(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   =   s    (   R   R   R   R   R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   6   s   		t   RowFactoryTestsBackwardsCompatc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   s   t  j d  |  _ d  S(   Ns   :memory:(   R   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   D   s    c         C   sU   |  j  j d t  } | j d  | j   } |  j t | t  d  | j   d  S(   NR   s   select 4+5 as foos   row is not instance of dict(	   R   R   R   t   executet   fetchoneR   R   t   dictR   (   R   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckIsProducedByFactoryG   s    c         C   s   |  j  j   d  S(   N(   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   P   s    (   R   R   R   R$   R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR    C   s   			t   RowFactoryTestsc           B   sP   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   c         C   s   t  j d  |  _ d  S(   Ns   :memory:(   R   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR   T   s    c         C   sD   d   |  j  _ |  j  j d  j   } |  j t | t  d  d  S(   Nc         S   s
   t  |  S(   N(   t   list(   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   <lambda>X   s    s   select 1, 2s   row is not instance of list(   R   R   R!   R"   R   R   R&   (   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckCustomFactoryW   s
    c         C   s
  t  j |  j _ |  j j d  j   } |  j t | t  j  d  | d | d } } |  j | d k d  |  j | d k d  | d | d	 } } |  j | d k d
  |  j | d k d  | d | d } } |  j | d k d  |  j | d k d  d  S(   Ns   select 1 as a, 2 as bs!   row is not instance of sqlite.Rowt   at   bi   s$   by name: wrong result for column 'a'i   t   At   Bs$   by name: wrong result for column 'A's$   by name: wrong result for column 'B'i    s#   by index: wrong result for column 0s#   by index: wrong result for column 1(   R   t   RowR   R   R!   R"   R   R   (   R   R   t   col1t   col2(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckSqliteRowIndex^   s    	c         C   s<   t  j |  j _ |  j j d  j   } x | D] } q. Wd S(   s$   Checks if the row object is iterables   select 1 as a, 2 as bN(   R   R-   R   R   R!   R"   (   R   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckSqliteRowIterq   s    c         C   s7   t  j |  j _ |  j j d  j   } t |  } d S(   s4   Checks if the row object can be converted to a tuples   select 1 as a, 2 as bN(   R   R-   R   R   R!   R"   t   tuple(   R   R   t   t(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckSqliteRowAsTuplex   s    c         C   sg   t  j |  j _ |  j j d  j   } t |  } |  j | d | d  |  j | d | d  d S(   sC   Checks if the row object can be correctly converted to a dictionarys   select 1 as a, 2 as bR)   R*   N(   R   R-   R   R   R!   R"   R#   t   assertEqual(   R   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckSqliteRowAsDict~   s
    c         C   s%  t  j |  j _ |  j j d  j   } |  j j d  j   } |  j j d  j   } |  j | | k  |  j | | k  |  j | | k  |  j | | k  |  j | | k  |  j | | k  |  j | |  |  j t	 |  t	 |   |  j
 | |  |  j
 t	 |  t	 |   d S(   s6   Checks if the row object compares and hashes correctlys   select 1 as a, 2 as bs   select 1 as a, 3 as bN(   R   R-   R   R   R!   R"   R   t   assertFalseR5   t   hasht   assertNotEqual(   R   t   row_1t   row_2t   row_3(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckSqliteRowHashCmp   s    c         C   s   |  j  j   d  S(   N(   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR      s    (
   R   R   R   R(   R0   R1   R4   R6   R=   R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR%   S   s   							t   TextFactoryTestsc           B   s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s   t  j d  |  _ d  S(   Ns   :memory:(   R   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR      s    c         C   sQ   t  d d  } |  j j d | f  j   } |  j t | d  t  k d  d  S(   Ns
   sterreicht   latin1s   select ?i    s   type of row[0] must be unicode(   t   unicodeR   R!   R"   R   t   type(   R   t   austriaR   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckUnicode   s    c         C   s   t  |  j _ t d d  } |  j j d | f  j   } |  j t | d  t  k d  |  j | d | j d  k d  d  S(   Ns
   sterreichR?   s   select ?i    s   type of row[0] must be strs   utf-8s(   column must equal original data in UTF-8(	   t   strR   t   text_factoryR@   R!   R"   R   RA   t   encode(   R   RB   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckString   s
     c         C   s   d   |  j  _ t d d  } |  j  j d | j d  f  j   } |  j t | d  t k d  |  j | d j d  d  d  S(	   Nc         S   s   t  |  d d  S(   Ns   utf-8t   ignore(   R@   (   t   x(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR'      s    s
   sterreichR?   s   select ?i    s   type of row[0] must be unicodeu   reichs!   column must contain original data(	   R   RE   R@   R!   RF   R"   R   RA   t   endswith(   R   RB   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckCustom   s
    ' c         C   s   t  j |  j _ t d d  } t d  } |  j j d | f  j   } |  j j d | f  j   } |  j t | d  t k d  |  j t | d  t	 k d  d  S(   Ns
   sterreichR?   t
   Deutchlands   select ?i    s%   type of non-ASCII row must be unicodes"   type of ASCII-only row must be str(
   R   t   OptimizedUnicodeR   RE   R@   R!   R"   R   RA   RD   (   R   RB   t   germanyt   a_rowt   d_row(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckOptimizedUnicode   s     c         C   s   |  j  j   d  S(   N(   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR      s    (   R   R   R   RC   RG   RK   RQ   R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR>      s   						t%   TextFactoryTestsWithEmbeddedZeroBytesc           B   s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s9   t  j d  |  _ |  j j d  |  j j d d  d  S(   Ns   :memory:s   create table test (value text)s#   insert into test (value) values (?)t   a b(   RS   (   R   R   R   R!   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR      s    c         C   sJ   |  j  j d  j   } |  j t | d  t  |  j | d d  d  S(   Ns   select value from testi    RS   (   R   R!   R"   t   assertIsRA   R@   R5   (   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyRG      s    c         C   sY   d   |  j  _ |  j  j d  j   } |  j t | d  t  |  j | d d  d  S(   Nc         S   s   |  S(   N(    (   RI   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR'      s    s   select value from testi    RS   (   R   RE   R!   R"   RT   RA   RD   R5   (   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyRK      s    c         C   sY   t  j |  j _ |  j j d  j   } |  j t | d  t  |  j	 | d d  d  S(   Ns   select value from testi    RS   (
   R   RM   R   RE   R!   R"   RT   RA   RD   R5   (   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckOptimizedUnicodeAsString   s    c         C   s|   t  j |  j _ |  j j d  |  j j d d  |  j j d  j   } |  j t | d  t  |  j	 | d d  d  S(   Ns   delete from tests#   insert into test (value) values (?)u   ä ös   select value from testi    (   u   ä ö(
   R   RM   R   RE   R!   R"   RT   RA   R@   R5   (   R   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   CheckOptimizedUnicodeAsUnicode   s    c         C   s   |  j  j   d  S(   N(   R   R   (   R   (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyR      s    (   R   R   R   RG   RK   RU   RV   R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyRR      s   						c          C   s   t  j t d  }  t  j t d  } t  j t d  } t  j t d  } t  j t d  } t  j t d  } t  j |  | | | | | f  S(   Nt   Check(	   t   unittestt	   makeSuiteR   R   R    R%   R>   RR   t	   TestSuite(   t   connection_suitet   cursor_suitet   row_suite_compatt	   row_suitet
   text_suitet   text_zero_bytes_suite(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   suite   s    c          C   s    t  j   }  |  j t    d  S(   N(   RX   t   TextTestRunnert   runRa   (   t   runner(    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   test   s    t   __main__(   RX   t   sqlite3R   R   R    R   R   R   t   TestCaseR   R   R    R%   R>   RR   Ra   Re   R   (    (    (    s\   /tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sqlite3/test/factory.pyt   <module>   s   	J#&			