Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_sqlite3/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_sqlite3/__pycache__/test_dbapi.cpython-312.opt-2.pyc

�

)Μg�&���ddlZddlZddlZddlZddlZddlZddlZddlZ	ddl
Z
ddlmZm
Z
mZmZmZddlmZddlmZmZddlmZmZmZddlmZmZmZmZmZd�Zej>ej@dfd	��Z!Gd
�dejD�Z#Gd�d
ejD�Z$Gd�dejD�Z%ejLe'ejPd�d�Gd�dejD��Z)Gd�dejD�Z*Gd�dejD�Z+Gd�dejD�Z,ejZ�Gd�dejD��Z.Gd�dejD�Z/Gd�dejD�Z0Gd �d!ejD�Z1Gd"�d#ejD�Z2Gd$�d%ejD�Z3e�Gd&�d'ejD��Z4e5d(k(rejl�yy))�N)�
SHORT_TIMEOUT�check_disallow_instantiation�requires_subprocess�
is_emscripten�is_wasi)�threading_helper)�INT_MAX�
ULLONG_MAX)�SEEK_SET�SEEK_CUR�SEEK_END)�TESTFN�TESTFN_UNDECODABLE�unlink�temp_dir�FakePathc�^�tjdg|��i|��}tj|�S�N�:memory:)�sqlite�connect�
contextlib�closing)�args�kwargs�cxs   �9/usr/local/lib/python3.12/test/test_sqlite3/test_dbapi.py�memory_databaser,s+��	���
�	4�T�	4�V�	4�B����b�!�!��c#�K�	|j||�}|��|j||�y#|j|�wxYw�w�N)�setlimit)r�category�limit�_prevs    r�cx_limitr'2s<����%����H�e�,����
���H�e�$�����H�e�$�s�A�-�A�A�Ac���eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zej(ej,dkd�d��Zd�Zd�Zy)�ModuleTestsc�h�|jtjddtjz�y)Nz2.0zapilevel is %s, should be 2.0)�assertEqualr�apilevel��selfs r�test_api_levelzModuleTests.test_api_level<s%��������%�8�6�?�?�J�	Lrc���d}dD]�}|j|��5|jt|�5}tt|�ddd�|jjt�|jt|�5}ttj|�ddd�|j|jt�ddd���y#1swY��xYw#1swY�@xYw#1swY��xYw)Nz-deprecated and will be removed in Python 3.14)�version�version_info)�attr)	�subTest�assertWarnsRegex�DeprecationWarning�getattrrr+�filename�__file__�dbapi2)r.�msgr3�cms    r�test_deprecated_versionz#ModuleTests.test_deprecated_version@s���=��-�D����4��(��*�*�+=�s�C�r��F�D�)�D�� � ����x�8��*�*�+=�s�C�r��F�M�M�4�0�D�� � ����x�8�
)�(�.�C�C��D�C��	)�(�s:�C&�C�>C&�C�(C&�C�C&�C#�C&�&C/	c�l�|jtjhd�dtjz�y)N>r��z'threadsafety is %d, should be 0, 1 or 3)�assertInr�threadsafetyr-s r�test_thread_safetyzModuleTests.test_thread_safetyKs)���
�
�f�)�)�9�?��)�)�*�	+rc�h�|jtjddtjz�y)N�qmarkz%paramstyle is '%s', should be 'qmark')r+r�
paramstyler-s r�test_param_stylezModuleTests.test_param_stylePs+������*�*�G�@��*�*�+�	,rc�`�|jttjt�d�y)Nz&Warning is not a subclass of Exception)�
assertTrue�
issubclassr�Warning�	Exceptionr-s r�test_warningzModuleTests.test_warningUs�����
�6�>�>�9�=�=�	?rc�`�|jttjt�d�y)Nz$Error is not a subclass of Exception)rIrJr�ErrorrLr-s r�
test_errorzModuleTests.test_errorYs�����
�6�<�<��;�>�	@rc�t�|jttjtj�d�y)Nz)InterfaceError is not a subclass of Error)rIrJr�InterfaceErrorrOr-s r�test_interface_errorz ModuleTests.test_interface_error]s%�����
�6�#8�#8�&�,�,�G�C�	Erc�t�|jttjtj�d�y)Nz(DatabaseError is not a subclass of Error)rIrJr�
DatabaseErrorrOr-s r�test_database_errorzModuleTests.test_database_erroras%�����
�6�#7�#7����F�B�	Drc�t�|jttjtj�d�y)Nz,DataError is not a subclass of DatabaseError)rIrJr�	DataErrorrUr-s r�test_data_errorzModuleTests.test_data_errores'�����
�6�#3�#3�V�5I�5I�J�F�	Hrc�t�|jttjtj�d�y)Nz3OperationalError is not a subclass of DatabaseError)rIrJr�OperationalErrorrUr-s r�test_operational_errorz"ModuleTests.test_operational_errori�'�����
�6�#:�#:�F�<P�<P�Q�M�	Orc�t�|jttjtj�d�y)Nz1IntegrityError is not a subclass of DatabaseError)rIrJr�IntegrityErrorrUr-s r�test_integrity_errorz ModuleTests.test_integrity_errorms'�����
�6�#8�#8�&�:N�:N�O�K�	Mrc�t�|jttjtj�d�y)Nz0InternalError is not a subclass of DatabaseError)rIrJr�
InternalErrorrUr-s r�test_internal_errorzModuleTests.test_internal_errorqs'�����
�6�#7�#7��9M�9M�N�J�	Lrc�t�|jttjtj�d�y)Nz3ProgrammingError is not a subclass of DatabaseError)rIrJr�ProgrammingErrorrUr-s r�test_programming_errorz"ModuleTests.test_programming_errorur]rc�t�|jttjtj�d�y)Nz4NotSupportedError is not a subclass of DatabaseError)rIrJr�NotSupportedErrorrUr-s r�test_not_supported_errorz$ModuleTests.test_not_supported_errorys*�����
�6�#;�#;�#)�#7�#7�9�N�	Prc��gd�}tjdk\r|ddgz
}tjdk\r|jd�tjdk\r|jd�|d	d
gz
}|gd�z
}tjdk\r|gd
�z
}tjdk\r|gd�z
}tjdk\r|gd�z
}tjdk\r|ddgz
}tjdk\r|jd�tjdk\r|jd�tjdk\r|jd�tjdk\r|jd�tjdk\r|jd�tjdk\r|jd�tjdk\r|gd�z
}tjd k\r|gd!�z
}tjd"k\r|d#d$gz
}tjd%k\r|d&d'gz
}tjd(k\r|gd)�z
}tjd*k\r|gd+�z
}tjd,k\r|jd-�|D]<}|j|�.�5|j	tt|��ddd��>y#1swY�IxYw)/N)J�SQLITE_ABORT�SQLITE_ALTER_TABLE�SQLITE_ANALYZE�
SQLITE_ATTACH�SQLITE_AUTH�SQLITE_BUSY�SQLITE_CANTOPEN�SQLITE_CONSTRAINT�SQLITE_CORRUPT�SQLITE_CREATE_INDEX�SQLITE_CREATE_TABLE�SQLITE_CREATE_TEMP_INDEX�SQLITE_CREATE_TEMP_TABLE�SQLITE_CREATE_TEMP_TRIGGER�SQLITE_CREATE_TEMP_VIEW�SQLITE_CREATE_TRIGGER�SQLITE_CREATE_VIEW�SQLITE_CREATE_VTABLE�
SQLITE_DELETE�SQLITE_DENY�
SQLITE_DETACH�SQLITE_DONE�SQLITE_DROP_INDEX�SQLITE_DROP_TABLE�SQLITE_DROP_TEMP_INDEX�SQLITE_DROP_TEMP_TABLE�SQLITE_DROP_TEMP_TRIGGER�SQLITE_DROP_TEMP_VIEW�SQLITE_DROP_TRIGGER�SQLITE_DROP_VIEW�SQLITE_DROP_VTABLE�SQLITE_EMPTY�SQLITE_ERROR�
SQLITE_FORMAT�SQLITE_FULL�SQLITE_FUNCTION�
SQLITE_IGNORE�
SQLITE_INSERT�SQLITE_INTERNAL�SQLITE_INTERRUPT�SQLITE_IOERR�
SQLITE_LOCKED�SQLITE_MISMATCH�
SQLITE_MISUSE�SQLITE_NOLFS�SQLITE_NOMEM�
SQLITE_NOTADB�SQLITE_NOTFOUND�	SQLITE_OK�SQLITE_PERM�
SQLITE_PRAGMA�SQLITE_PROTOCOL�SQLITE_RANGE�SQLITE_READ�SQLITE_READONLY�SQLITE_REINDEX�
SQLITE_ROW�SQLITE_SAVEPOINT�
SQLITE_SCHEMA�
SQLITE_SELECT�
SQLITE_TOOBIG�SQLITE_TRANSACTION�
SQLITE_UPDATE�SQLITE_LIMIT_LENGTH�SQLITE_LIMIT_SQL_LENGTH�SQLITE_LIMIT_COLUMN�SQLITE_LIMIT_EXPR_DEPTH�SQLITE_LIMIT_COMPOUND_SELECT�SQLITE_LIMIT_VDBE_OP�SQLITE_LIMIT_FUNCTION_ARG�SQLITE_LIMIT_ATTACHED� SQLITE_LIMIT_LIKE_PATTERN_LENGTH�SQLITE_LIMIT_VARIABLE_NUMBER�SQLITE_LIMIT_TRIGGER_DEPTH)r@���
SQLITE_NOTICE�SQLITE_WARNING)r@�r@�SQLITE_RECURSIVE)r@r�r��SQLITE_LIMIT_WORKER_THREADS�PARSE_DECLTYPES�PARSE_COLNAMES) �SQLITE_ABORT_ROLLBACK�SQLITE_BUSY_RECOVERY�SQLITE_CANTOPEN_FULLPATH�SQLITE_CANTOPEN_ISDIR�SQLITE_CANTOPEN_NOTEMPDIR�SQLITE_CORRUPT_VTAB�SQLITE_IOERR_ACCESS�SQLITE_IOERR_BLOCKED�SQLITE_IOERR_CHECKRESERVEDLOCK�SQLITE_IOERR_CLOSE�SQLITE_IOERR_DELETE�SQLITE_IOERR_DELETE_NOENT�SQLITE_IOERR_DIR_CLOSE�SQLITE_IOERR_DIR_FSYNC�SQLITE_IOERR_FSTAT�SQLITE_IOERR_FSYNC�SQLITE_IOERR_LOCK�SQLITE_IOERR_NOMEM�SQLITE_IOERR_RDLOCK�SQLITE_IOERR_READ�SQLITE_IOERR_SEEK�SQLITE_IOERR_SHMLOCK�SQLITE_IOERR_SHMMAP�SQLITE_IOERR_SHMOPEN�SQLITE_IOERR_SHMSIZE�SQLITE_IOERR_SHORT_READ�SQLITE_IOERR_TRUNCATE�SQLITE_IOERR_UNLOCK�SQLITE_IOERR_WRITE�SQLITE_LOCKED_SHAREDCACHE�SQLITE_READONLY_CANTLOCK�SQLITE_READONLY_RECOVERY�r@r��)
�SQLITE_CONSTRAINT_CHECK�SQLITE_CONSTRAINT_COMMITHOOK�SQLITE_CONSTRAINT_FOREIGNKEY�SQLITE_CONSTRAINT_FUNCTION�SQLITE_CONSTRAINT_NOTNULL�SQLITE_CONSTRAINT_PRIMARYKEY�SQLITE_CONSTRAINT_TRIGGER�SQLITE_CONSTRAINT_UNIQUE�SQLITE_CONSTRAINT_VTAB�SQLITE_READONLY_ROLLBACK)�SQLITE_IOERR_MMAP�SQLITE_NOTICE_RECOVER_ROLLBACK�SQLITE_NOTICE_RECOVER_WAL)r@r�r)�SQLITE_BUSY_SNAPSHOT�SQLITE_IOERR_GETTEMPPATH�SQLITE_WARNING_AUTOINDEX)r@r�r?�SQLITE_CANTOPEN_CONVPATH�SQLITE_IOERR_CONVPATH)r@r���SQLITE_CONSTRAINT_ROWID�SQLITE_READONLY_DBMOVED�SQLITE_AUTH_USER)r@�	r�SQLITE_IOERR_VNODE)r@�
r�SQLITE_IOERR_AUTH)r@�r?�SQLITE_OK_LOAD_PERMANENTLY)r@�r)�SQLITE_IOERR_BEGIN_ATOMIC�SQLITE_IOERR_COMMIT_ATOMIC�SQLITE_IOERR_ROLLBACK_ATOMIC)r@�r)�SQLITE_ERROR_MISSING_COLLSEQ�SQLITE_ERROR_RETRY�SQLITE_READONLY_CANTINIT�SQLITE_READONLY_DIRECTORY)r@�r�SQLITE_CORRUPT_SEQUENCE�SQLITE_LOCKED_VTAB�r@�r�SQLITE_CANTOPEN_DIRTYWAL�SQLITE_ERROR_SNAPSHOT)r@�r)�SQLITE_CANTOPEN_SYMLINK�SQLITE_CONSTRAINT_PINNED�SQLITE_OK_SYMLINK)r@� r)�SQLITE_BUSY_TIMEOUT�SQLITE_CORRUPT_INDEX�SQLITE_IOERR_DATA)r@�"r�SQLITE_IOERR_CORRUPTFS)�const)r�sqlite_version_info�appendr4rI�hasattr)r.�constsrs   r�test_module_constantsz!ModuleTests.test_module_constants~s���L
��Z�%�%��3���(8�9�9�F��%�%��2��M�M�,�-��%�%��2��M�M�7�8��$�&6�7�7���!
�!	
��D�%�%��3���
�F��%�%��3���
�F�
�%�%��2���
�F�
�%�%��2��1�3J�K�K�F��%�%��2��M�M�3�4��%�%��2��M�M�3�4��%�%��2��M�M�,�-��%�%��2��M�M�.�/��%�%��3��M�M�-�.��%�%��3��M�M�6�7��%�%��3���
�F�
�%�%��3���
�F��%�%��3��0�2F�G�G�F��%�%��3��1�3J�K�K�F��%�%��3���
�F�
�%�%��3���
�F�
�%�%��3��M�M�2�3��E����E��*������� 6�7�+�*��*�*�s� J7�7K	c��d}tjjd�rtj}ntj
}t
�5}|jtj|�5}tj|�ddd�j}|j|j|�|j|jjd��ddd�y#1swY�dxYw#1swYyxYw)N�unable to open database file�winrq)�sys�platform�
startswithrr�rqr�assertRaisesRegexrOr�	exceptionr+�sqlite_errorcoderI�sqlite_errorname)r.�err_msg�err_code�dbr<�es      r�test_error_code_on_exceptionz(ModuleTests.test_error_code_on_exception@s���0���<�<�"�"�5�)��3�3�H��-�-�H�
�Z�2��'�'����g�>�"����r�"�?����A����Q�/�/��:��O�O�A�.�.�9�9�:K�L�M��Z�>�>���Z�s%�
!C3�.C'�AC3�'C0	�,C3�3C<r�zRequires SQLite 3.7.16 or newerc���t�5}|5|jd�ddd�d}|jtj|�5}|jd�ddd�j
}|j
|jtj�|j
|jd�ddd�y#1swY��xYw#1swY�pxYw#1swYyxYw)Nz&create table t(t integer check(t > 0))zconstraint failedzinsert into t values(-1)r�)
r�executer"rr_r#r+r$r�r%)r.�con�errmsgr<�excs     r�%test_extended_error_code_on_exceptionz1ModuleTests.test_extended_error_code_on_exceptionNs����
�#�����D�E��(�F��'�'��(=�(=�v�F�"����6�7�G��,�,�C����S�1�1�#�;�;�
=����S�1�1�3L�M��
����G�F��	�
�s:�C�B?�*C�
C�AC�?C	�C�C	�C�C c��tjd�}t|t|d���t|tj�y)Nr�select 1)rrr�type�Blob�r.rs  r�test_disallow_instantiationz'ModuleTests.test_disallow_instantiation\s1��
�^�^�J�
'��$�T�4��:��+?�@�$�T�6�;�;�7rc��|jtjd��|jtjd��y)Nzselect tzcreate table t(t);)�assertFalser�complete_statementrIr-s r�test_complete_statementz#ModuleTests.test_complete_statementas3������2�2�:�>�?�����1�1�2F�G�HrN)�__name__�
__module__�__qualname__r/r=rCrGrMrPrSrVrYr\r`rcrfrirr*�unittest�skipIfrrr0r6r:�rrr)r);s���L�	9�+�
,�
?�@�E�D�H�O�M�L�O�P�
@8�DN��X�_�_�V�/�/�:�=�6�8�
N�8�
N�8�
Irr)c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�ConnectionTestsc��tjd�|_|jj�}|j	d�|j	dd�y)Nrz4create table test(id integer primary key, name text)�!insert into test(name) values (?)��foo)rrr�cursorr,�r.�cus  r�setUpzConnectionTests.setUphs>���.�.��,���
�W�W�^�^�
��
�
�
�I�J�
�
�
�6��Arc�8�|jj�yr"�r�closer-s r�tearDownzConnectionTests.tearDownn������
�
�rc�8�|jj�yr"�r�commitr-s r�test_commitzConnectionTests.test_commitqs�������rc�n�	|jj�|jj�yr"rQr-s r�test_commit_after_no_changesz,ConnectionTests.test_commit_after_no_changests%��	�	
�����������rc�8�|jj�yr"�r�rollbackr-s r�
test_rollbackzConnectionTests.test_rollback{s�������rc�n�	|jj�|jj�yr"rWr-s r�test_rollback_after_no_changesz.ConnectionTests.test_rollback_after_no_changes~s)��	�	
�����������rc�8�|jj�}yr"�rrGrHs  r�test_cursorzConnectionTests.test_cursor�s��
�W�W�^�^�
�rc��d}|jtj�5tj|�ddd�y#1swYyxYw)Nz/foo/bar/bla/23534/mydb.db)�assertRaisesrr[r)r.�YOU_CANNOT_OPEN_THISs  r�test_failed_openz ConnectionTests.test_failed_open�s5��;��
�
�
�v�6�6�
7��N�N�/�0�8�
7�
7�s�A�A
c�8�|jj�yr"rLr-s r�
test_closezConnectionTests.test_close�rOrc��d}|jj�}|j|�}|jj�|j	t
j|j�|j	t
j|j|�|j	t
j|j|g�|j	t
j|j|�|j	t
j|jj|�|j	t
j|jj|g�|j	t
j|jj|�|j	t
j|jjddd��|j	t
j|jj�|j	t
j�5|j5	ddd�ddd�y#1swY�xYw#1swYyxYw)Nr2�tr?c��|Sr"r@��xs r�<lambda>z6ConnectionTests.test_use_after_close.<locals>.<lambda>�s��Qr)rrGr,rMr`rre�fetchall�executemany�
executescript�create_function)r.�sqlrI�ress    r�test_use_after_closez$ConnectionTests.test_use_after_close�s�����
�W�W�^�^�
���j�j��o�����
�
�����&�1�1�3�<�<�@����&�1�1�2�:�:�s�C����&�1�1�2�>�>�3��K����&�1�1�2�3C�3C�S�I����&�1�1�4�7�7�?�?�C�H����&�1�1��'�'�-�-�s�B�	8����&�1�1�4�7�7�3H�3H�#�N����&�1�1��'�'�1�1�3��;�	H����&�1�1�4�7�7�>�>�B�
�
�
�v�6�6�
7������8�
7����8�
7�s$�
I�,H?�.I�?I	�I�Ic��|j|jjtj�|j|jjtj�|j|jj
tj
�|j|jjtj�|j|jjtj�|j|jjtj�|j|jjtj�|j|jjtj�|j|jjtj�|j|jjtj�yr")
r+rrKrrOrRrUrXr[r_rbrerhr-s r�test_exceptionszConnectionTests.test_exceptions�s:����������&�.�.�9������������5�������/�/��1F�1F�G�������.�.��0D�0D�E�������*�*�F�,<�,<�=�������1�1�6�3J�3J�K�������/�/��1F�1F�G�������.�.��0D�0D�E�������1�1�6�3J�3J�K�������2�2�F�4L�4L�Mrc��tjd�}|j�}|j|jd�|jd�|j|jd�|jdd�|j|jd�|jddg�|j
�}|j|jd�|j�|j|jd�|jddg�|j
�}|j|jd�y)	NrFz?create table transactiontest(id integer primary key, name text)z,insert into transactiontest(name) values (?)rETz-select name from transactiontest where name=?rF)rrrGr+�in_transactionr,�fetchonerR)r.rrI�rows    r�test_in_transactionz#ConnectionTests.test_in_transaction�s���
�^�^�J�
'��
�Y�Y�[������*�*�E�2�
�
�
�T�U�����*�*�E�2�
�
�
�A�8�L�����*�*�D�1�
�
�
�B�U�G�L��k�k�m������*�*�D�1�
�	�	������*�*�E�2�
�
�
�B�U�G�L��k�k�m������*�*�E�2rc�z�|jt�5d|j_ddd�y#1swYyxYw)NT)r`�AttributeErrorrrur-s r�test_in_transaction_roz&ConnectionTests.test_in_transaction_ro�s(��
�
�
�~�
.�%)�D�G�G�"�/�
.�
.�s�1�:c	��gd�}|D]v}|j|��5|jt|j|��|j	tt|�t|j|��ddd��xy#1swY��xYw)N)	rXrUrOr_rRrhr[rerK)r/)r4rIrr�assertIsr7r)r.�
exceptionsr/s   r�test_connection_exceptionsz*ConnectionTests.test_connection_exceptions�si��

�
��C����#��&��������� 5�6��
�
�g�f�c�2�G�D�G�G�S�4I�J�'�&��&�&�s�AB�B
	c���tjd�}|j�|jtj�5|j�ddd�y#1swYyxYwr)rrrMr`re�	interruptr5s  r�test_interrupt_on_closed_dbz+ConnectionTests.test_interrupt_on_closed_db�sB��
�^�^�J�
'��
���
�
�
�
�v�6�6�
7��L�L�N�8�
7�
7���A�A(c�V�|j|jj��yr")�assertIsNonerr�r-s r�test_interruptzConnectionTests.test_interrupt�s�����$�'�'�+�+�-�.rc��td�D]C}|jjd|���}|j|j	�d|��Ey)Ni�zselect r)�rangerr,r+rv)r.�nrIs   r�test_drop_unused_refsz%ConnectionTests.test_drop_unused_refs�sC���s��A������7�1�#��/�B����R�[�[�]�1�-�q�1�rc��tj}|jj|�}	d}|jj	||�}|j||�|j|jj|�|�d}|j
tj||jjd�|jj	||�y#|jj	||�wxYw)Nr��query string is too largezselect 1 as '16')	rr�r�getlimitr#r+r"rXr,)r.r$�saved_limit�	new_limit�
prev_limitr;s      r�test_connection_limitsz&ConnectionTests.test_connection_limits�s����1�1���g�g�&�&�x�0��		4��I����)�)�(�I�>�J����[�*�5����T�W�W�-�-�h�7��C�-�C��"�"�6�#3�#3�S�#'�7�7�?�?�4F�
H�
�G�G���X�{�3��D�G�G���X�{�3�s�BC�C;c���d}d}|jtj||jj|�|jtj||jj
|d�y)Nz'category' is out of boundsiWr)r"rrerr�r#)r.r;�cats   r�"test_connection_bad_limit_categoryz2ConnectionTests.test_connection_bad_limit_category�s\��+�������v�6�6��#�w�w�/�/��	6����v�6�6��#�w�w�/�/��a�	9rc	��d}d}|D]�}|j|��5|jt|�5t|��ddd�t�5}|jt|�5||_ddd�|j|jd�ddd�ddd���y#1swY�ixYw#1swY�DxYw#1swY�,xYw#1swY��xYw)NzJisolation_level string must be '', 'DEFERRED', 'IMMEDIATE', or 'EXCLUSIVE')�BOGUS� �DEFERRE�IMMEDIAT�EXCLUSIV�	DEFERREDS�
IMMEDIATES�
EXCLUSIVES��level��isolation_level�)r4r"�
ValueErrorrr�r+)r.r;�levelsr�rs     r�(test_connection_init_bad_isolation_levelz8ConnectionTests.test_connection_init_bad_isolation_level�s���
�	�	
���E����E��*��+�+�J��<�#�E�:�=�$�&�"��/�/�
�C�@�-2��*�A��$�$�R�%7�%7��<�	'�+�*��<�<��A�@��'�&��+�*�sR�C�
B(�C�C�)B4	�1$C�C�(B1�-C�4B=
�9C�C	�C�C	c��dD]�}|j|��5t|��5}|j|j|�ddd�t�5}|j|jd�||_|j|j|�ddd�ddd���y#1swY�fxYw#1swY� xYw#1swY��xYw)N)r��DEFERRED�	IMMEDIATE�	EXCLUSIVENr�r�r�)r4rr+r�)r.r�rs   r�*test_connection_init_good_isolation_levelsz:ConnectionTests.test_connection_init_good_isolation_levelss���E�E����E��*�$�U�;�r��$�$�R�%7�%7��?�<�$�&�"��$�$�R�%7�%7��<�).�B�&��$�$�R�%7�%7��?�'�+�*�F�;�;��&�&��+�*�s;�
B?�B'�B?�AB3�B?�'B0�,B?�3B<�8B?�?C	c�F�d}tj|�}t|_tj|_|j
�}|jd�|jdd�td�D��|jd�|jd�D�cgc]}|��}}|jtd�|D���|j|D�cgc]}|d	��	c}d
dg�|j|�|jd�|jdd�d
D��|j�D�cgc]}|��}}|jtd�|D���|j|D�cgc]}|d	��	c}ddg�ycc}wcc}wcc}wcc}w)Nrzcreate table foo (bar)z insert into foo (bar) values (?)c3�4K�|]}t|�f���y�wr")�str��.0�vs  r�	<genexpr>z9ConnectionTests.test_connection_reinit.<locals>.<genexpr>'s����4�8�a��Q��	�8�s��zselect bar from foor�c3�PK�|]}t|tj���� y�wr"��
isinstancer�Row�r��rs  rr�z9ConnectionTests.test_connection_reinit.<locals>.<genexpr>+�����D�t�!�J�q�&�*�*�5�t���$&r�0�1c3�"K�|]}|f���	y�wr"r@r�s  rr�z9ConnectionTests.test_connection_reinit.<locals>.<genexpr>1s����;�&:����&:���
)�a�b�c�dc3�PK�|]}t|tj���� y�wr"r�r�s  rr�z9ConnectionTests.test_connection_reinit.<locals>.<genexpr>5r�r��2�3)rr�bytes�text_factoryr��row_factoryrGr,rlr��	fetchmanyrI�allr+�__init__rk)r.r(rrIr��rowss      r�test_connection_reinitz&ConnectionTests.test_connection_reinits[��
��
�^�^�B�
����������
�Y�Y�[��
�
�
�+�,�
���9�4�5��8�4�	6�
�
�
�(�)��<�<��?�+�?�a��?��+�����D�t�D�D�E�����-��1�!�A�$��-��d�|�<�
���B��
�
�
�+�,�
���9�;�&:�;�	=��;�;�=�)�=�a��=��)�����D�t�D�D�E�����-��1�!�A�$��-��S�z�:��,��-��*��-s�	F�F�=	F�8Fc��tjd�}|5|jd�ddd�t�5}|j	tj
d|j|�|j	tjd|jdd�td�D��ddd�y#1swY��xYw#1swYyxYw)Nr�create table t(t)r�#Base Connection.__init__ not calledzinsert into t values(?)c3�"K�|]}|f���	y�wr"r@r�s  rr�z=ConnectionTests.test_connection_bad_reinit.<locals>.<genexpr>Cs����#;�(�Q�Q�D�(�r�r@)
rrr,rr"r[r�rerlr�)r.rr(s   r�test_connection_bad_reinitz*ConnectionTests.test_connection_bad_reinit8s���
�^�^�J�
'��
��J�J�*�+��
�Z�2��"�"�6�#:�#:�#A�#%�;�;��
4�
�"�"�6�#:�#:�#H�#%�>�>�3L�#;�%��(�#;�
=�	�Z��R��
�Z�s�B/�A*B;�/B8�;Cc��tj}t�5}|jtd�5|jd�ddd�|j|�}|}|j
||�|j|j|�|�|j
|�|j|j|��|5|jd�ddd�|jtjd�5|jd�ddd�ddd�y#1swY��xYw#1swY�XxYw#1swY�*xYw#1swYyxYw)N�unknown���z�
                    create table t(t integer primary key);
                    create table u(u, foreign key(u) references t(t));
                �
constraintzinsert into u values(0))r�SQLITE_DBCONFIG_ENABLE_FKEYrr"r��	getconfig�	setconfigr+rIrmr_r,)r.�opr�old�news     r�test_connection_configz&ConnectionTests.test_connection_configEs��
�
/�
/��
�
�"��'�'�
�I�>����R� �?��,�,�r�"�C��'�C��L�L��S�!����R�\�\�"�-�s�3��L�L����O�O�B�L�L��,�-��� � �"���
�'�'��(=�(=�|�L��
�
�4�5�M�'�
�>�>�����
M�L��'�
�sS�E�D#�BE�D/�(E�D;�E�#D,	�(E�/D8	�4E�;E	�E�EN)r;r<r=rJrNrSrUrYr[r^rbrdrqrsrxr{rr�r�r�r�r�r�r�r�r�r�r@rrrBrBfs~��B�������1�
��(N�3�$*�K�"�/�2�
4�9�=�2@�;�2=�6rrBc��eZdZd�Zd�Zy)�UninitialisedConnectionTestsc�h�tjjtj�|_yr")r�
Connection�__new__rr-s rrJz"UninitialisedConnectionTests.setUp_s ���#�#�+�+�F�,=�,=�>��rc�����fd��fd��fd��fd��fd��fd�f}|D]>}�j|��5�jtjd|�ddd��@y#1swY�KxYw)	Nc�0���jjSr")rr�r-s�rrjzEUninitialisedConnectionTests.test_uninit_operations.<locals>.<lambda>ds���D�G�G�+�+rc�0���jjSr")r�
total_changesr-s�rrjzEUninitialisedConnectionTests.test_uninit_operations.<locals>.<lambda>es���D�G�G�)�)rc�0���jjSr")rrur-s�rrjzEUninitialisedConnectionTests.test_uninit_operations.<locals>.<lambda>fs���D�G�G�*�*rc�8���jj�Sr")r�iterdumpr-s�rrjzEUninitialisedConnectionTests.test_uninit_operations.<locals>.<lambda>gs���D�G�G�$�$�&rc�8���jj�Sr"r]r-s�rrjzEUninitialisedConnectionTests.test_uninit_operations.<locals>.<lambda>hs���D�G�G�N�N�$rc�8���jj�Sr"rLr-s�rrjzEUninitialisedConnectionTests.test_uninit_operations.<locals>.<lambda>is���D�G�G�M�M�Or)�funcr�)r4r"rre)r.�funcsr�s`  r�test_uninit_operationsz3UninitialisedConnectionTests.test_uninit_operationsbsa���+�)�*�&�$�#�

���D����4��(��&�&�v�'>�'>�'L�'+�-�)�(��(�(�s�"A � A)	N)r;r<r=rJr�r@rrr�r�^s��?�
-rr��	serializezNeeds SQLite serialize APIc��eZdZd�Zd�Zd�Zy)�SerializeTestsc���t�5}|5|jd�ddd�|j�}|5|jd�ddd�d}|jtj
|�5|jd�ddd�|j
|�|jd�ddd�y#1swY��xYw#1swY�|xYw#1swY�LxYw#1swYyxYw)Nr�zdrop table tz
no such tablezselect t from t)rr,r�r"rr[�deserialize)r.r�data�regexs    r�test_serialize_deserializez)SerializeTests.test_serialize_deserializeus���
�
�"���
�
�.�/���<�<�>�D���
�
�>�*��#�E��'�'��(?�(?��G��
�
�,�-�H�
�N�N�4� ��J�J�(�)��
����
���H�G���
�sP�C�B;�C�C�*C�6C�*C�;C	�C�C	�C�C	�C�C(c�:�ttd�ddd�ftgftdftdff}|D]Q\}}|j||��5t	�5}|j||j|�ddd�ddd��Sy#1swY�xYw#1swY�jxYw)Nsblobr�r?)r/�arg)�BufferError�
memoryview�	TypeErrorr4rr`r�)r.�datasetr/r�rs     r�test_deserialize_wrong_argsz*SerializeTests.test_deserialize_wrong_args�s���
�*�W�-�c��c�2�3�
��O�
��N�
���	
�� �H�C�����#�3��/�$�&�"��%�%�c�2�>�>�3�?�'�0�/� �&�&��0�/�s$�	B�B�2B�B�
B�B	c���t�5}d}|jtj|�5|j	d�|jd�ddd�ddd�y#1swY�xYw#1swYyxYw)Nzfile is not a databaseszcreate table fail(f))rr"rrUr�r,)r.rr�s   r�!test_deserialize_corrupt_databasez0SerializeTests.test_deserialize_corrupt_database�s^��
�
�"�,�E��'�'��(<�(<�e�D����y�)��
�
�1�2�	E��
�D�D���
�s"�#A.�#A"�A.�"A+	�'A.�.A7N)r;r<r=r�r�r�r@rrr�r�rs��*�"
@�3rr�c��eZdZdZd�Zejejdk(d�ejejdk(d�eje	xse
d�ejed�d	�����Z
d
�Zd�Zd�Zejejdk(d�ejejdk(d�eje	xse
d�ejed�d
�����Zd�Zd�Zy)�	OpenTestszcreate table test(id integer)c��	tt�}|jt|�|j	t
jj|��tjtj|��5}|jt
jj|��|j|j�ddd�y#1swYyxYwr")rr�
addCleanuprr8�os�path�existsrrrrrIr,�_sql�r.rrs   r�test_open_with_path_like_objectz)OpenTests.test_open_with_path_like_object�s���	4����������%����������-�.�
�
�
����t� 4�
5���O�O�B�G�G�N�N�4�0�1��J�J�t�y�y�!�6�
5�
5�s
�=A
C�C�win32zskipped on Windows�darwinzskipped on macOSz not supported on Emscripten/WASIz)only works if there are undecodable pathsc��t}|jt|�|jtj
j
|��tjtj|��5}|jtj
j
|��|j|j�ddd�y#1swYyxYwr")rrrr8rrrrrrrrIr,rrs   r�test_open_with_undecodable_pathz)OpenTests.test_open_with_undecodable_path�s���
"�������%����������-�.�
�
�
����t� 4�
5���O�O�B�G�G�N�N�4�0�1��J�J�t�y�y�!�6�
5�
5�s
�3A
C�Cc��t}|jt|�dtjjt
j|��z}|jtjj|��tjtj|d���5}|jtjj|��|j!|j"�ddd�y#1swYyxYw�N�file:T��uri)rrr�urllib�parse�quoter�fsencoder8rrrrrrrIr,r�r.rrrs    r�
test_open_urizOpenTests.test_open_uri�s����������%�����*�*�2�;�;�t�+<�=�=�����������-�.�
�
�
����s�� =�
>�"��O�O�B�G�G�N�N�4�0�1��J�J�t�y�y�!�?�
>�
>�s
�*A
C=�=Dc��t}|jt|�d|z}|jtj
j
|��tjtj|d���5}|jtj
j
|��|j|j�ddd�y#1swYyxYwr)rrrr8rrrrrrrrIr,rrs    r�test_open_unquoted_uriz OpenTests.test_open_unquoted_uri�s����������%���n�����������-�.�
�
�
����s�� =�
>�"��O�O�B�G�G�N�N�4�0�1��J�J�t�y�y�!�?�
>�
>�s
�:A
C
�
Cc��t}|jt|�dtjjt
j|��zdz}|jtjj|��|jtj�5tj|d��ddd�|jtjj|��tj|�j�|j!tjj|��t#j$tj|d���5}|jtj�5|j'|j(�ddd�ddd�y#1swY��xYw#1swY�xYw#1swYyxYw)Nrz?mode=roTr)rrrrrrrrr8rrr`rr[rrMrIrrr,rrs    r�test_open_uri_readonlyz OpenTests.test_open_uri_readonly�s.���������%�����*�*�2�;�;�t�+<�=�=�
�J�����������-�.�
�
�
�v�6�6�
7��N�N�3�D�)�8����������-�.����t��"�"�$���������t�,�-�
�
�
����s�� =�
>�"��"�"�6�#:�#:�;��
�
�4�9�9�%�<�?�
>�
8�
7��<�;��?�
>�s0�"F8�+ G�G�'G�8G�G
	�	G�Gc���t}|jt|�dtjj|�z}|j
tjj|��tjtj|d���5}|jtjj|��|j|j �ddd�y#1swYyxYwr)rrrrrrr8rrrrrrrrIr,rrs    r�test_open_undecodable_uriz#OpenTests.test_open_undecodable_uri�s���
"�������%�����*�*�4�0�0�����������-�.�
�
�
����s�� =�
>�"��O�O�B�G�G�N�N�4�0�1��J�J�t�y�y�!�?�
>�
>�s
�A
C*�*C3c�(���fd�}ttjt�tt�ttjt��fD];}d�t	j
||��j
�|j�|��=y)Nc�:��|�tjdg|��i|��Sr)rr�)�databaserr�database_args   �r�factoryz4OpenTests.test_factory_database_arg.<locals>.factory�s#���#�L��$�$�Z�A�$�A�&�A�Ar)r#)rrrrrrrMr+)r.r#r!r"s   @r�test_factory_database_argz#OpenTests.test_factory_database_arg�sk���	B�
 ����V�!4�!�&�)�8�B�K�K��4G�+H�J�H��L��N�N�8�W�5�;�;�=����\�8�4�	Jrc���tjtjd���5}|j	t|�tj�ddd�y#1swYyxYw)Nr)r!)rrrrr+r3r�r5s  r�test_database_keywordzOpenTests.test_database_keyword�sB��
�
�
����
� C�
D�����T�"�X�v�'8�'8�9�E�
D�
D�s�*A�A&N)r;r<r=rr	r>r?rr rr�
skipUnlessrr
rrrrr$r&r@rrrr�s)��*�D�"��X�_�_�S�\�\�W�,�.B�C��X�_�_�S�\�\�X�-�/A�B��X�_�_�]�-�g�/Q�R��X���+�-X�Y�"�Z�S�C�D�"�"�"�&� �X�_�_�S�\�\�W�,�.B�C��X�_�_�S�\�\�X�-�/A�B��X�_�_�]�-�g�/Q�R��X���+�-X�Y�"�Z�S�C�D�"�
5�:rrc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z e!jDe#jHdkd �d!��Z%d"�Z&d#�Z'd$�Z(d%�Z)d&�Z*d'�Z+d(�Z,d)�Z-d*�Z.d+�Z/d,�Z0d-�Z1d.�Z2d/�Z3d0�Z4d1�Z5d2�Z6d3�Z7d4�Z8d5�Z9d6�Z:d7�Z;d8�Z<d9�Z=d:�Z>d;�Z?d<�Z@y=)>�CursorTestsc���tjd�|_|jj�|_|jjd�|jjdd�y)Nrz\create table test(id integer primary key, name text, income number, unique_test text unique)rDrE�rrrrGrIr,r-s rrJzCursorTests.setUp�sN���.�.��,����'�'�.�.�"��������
6�	
�	
�����;�X�Frc�l�|jj�|jj�yr"�rIrMrr-s rrNzCursorTests.tearDown�������
�
�����
�
�rc�:�|jjd�y)N�delete from test�rIr,r-s r�test_execute_no_argsz CursorTests.test_execute_no_argss�������*�+rc��|jtj�5|jj	d�ddd�y#1swYyxYw)Nzselect asdf)r`rr[rIr,r-s r�test_execute_illegal_sqlz$CursorTests.test_execute_illegal_sqls2��
�
�
�v�6�6�
7��G�G�O�O�M�*�8�
7�
7���A�Ac��d}d}|D]a}|j|��5|jtj|�5|jj|�ddd�ddd��cy#1swY�xYw#1swY�zxYw)Nz,You can only execute one statement at a time)
zselect 1; select 2z)select 1; // c++ comments are not allowedzselect 1; *not a commentzselect 1; -*not a commentzselect 1; /* */ azselect 1; /**/azselect 1; -zselect 1; /zselect 1; -
- select 2zHselect 1;
               -- comment
               select 2
            ��query)r4r"rrerIr,)r.r;r�r8s    r� test_execute_multiple_statementsz,CursorTests.test_execute_multiple_statements
sl��<��
���E����E��*��+�+�F�,C�,C�S�I��G�G�O�O�E�*�J�+�*��I�I��+�*�s"�!A8�A,�A8�,A5�1A8�8B	c��d}|D]8}|j|��5|jj|�ddd��:y#1swY�ExYw)N)zselect 1; -- foo barzselect 1; --zselect 1; /*zT
            select 5+4;

            /*
            foo
            */
            r7)r4rIr,)r.r�r8s   r�#test_execute_with_appended_commentsz/CursorTests.test_execute_with_appended_comments sB��
���E����E��*�������&�+�*��*�*�s�A�A
	c��|jt�5|jjd�ddd�y#1swYyxYw�N�*)r`r�rIr,r-s r�test_execute_wrong_sql_argz&CursorTests.test_execute_wrong_sql_arg1s,��
�
�
�y�
)��G�G�O�O�B��*�
)�
)�s	�;�Ac�<�|jjdd�y)N�insert into test(id) values (?))r>r1r-s r�test_execute_arg_intz CursorTests.test_execute_arg_int5s�������9�5�Arc�<�|jjdd�y)N�#insert into test(income) values (?))gq=
ף��@r1r-s r�test_execute_arg_floatz"CursorTests.test_execute_arg_float8s�������=�z�Jrc�<�|jjdd�y)NrD)�Hugor1r-s r�test_execute_arg_stringz#CursorTests.test_execute_arg_string;s�������;�Y�Grc��|jjdd�|jjd|jjf�|jj�}|j	|dd�y)NrD)�Hugoz select name from test where id=?rrJ)rIr,�	lastrowidrvr+�r.rws  r�&test_execute_arg_string_with_zero_bytez2CursorTests.test_execute_arg_string_with_zero_byte>s[�������;�]�K������:�T�W�W�=N�=N�<P�Q��g�g��� ������Q���,rc���|jtj�5}|jj	dd�ddd�|jt
j�d�y#1swY�/xYw)NrAr>z"parameters are of unsupported type)r`rrerIr,r+r�r#)r.r<s  r�test_execute_non_iterablez%CursorTests.test_execute_non_iterableEsS��
�
�
�v�6�6�
7�2��G�G�O�O�=�r�B�8�����R�\�\�*�,P�Q�8�
7�s�A+�+A4c��|jtj�5|jj	dd�ddd�y#1swYyxYw)NrA)r��Egon�r`rrerIr,r-s r�test_execute_wrong_no_of_args1z*CursorTests.test_execute_wrong_no_of_args1Js5��
�
�
�v�6�6�
7��G�G�O�O�=�|�L�8�
7�
7�s�A�Ac��|jtj�5|jj	d�ddd�y#1swYyxYw�NrArRr-s r�test_execute_wrong_no_of_args2z*CursorTests.test_execute_wrong_no_of_args2O�3��
�
�
�v�6�6�
7��G�G�O�O�=�>�8�
7�
7�r5c��|jtj�5|jj	d�ddd�y#1swYyxYwrUrRr-s r�test_execute_wrong_no_of_args3z*CursorTests.test_execute_wrong_no_of_args3TrWr5c���|jjd�|jjddg�|jj�}|j|dd�y)N�%insert into test(name) values ('foo')�"select name from test where name=?rFr�rIr,rvr+rLs  r�test_execute_param_listz#CursorTests.test_execute_param_listYsN�������?�@������<�u�g�F��g�g��� ������Q���'rc���Gd�d�}|jjd�|jjd|��|jj�}|j|dd�y)Nc��eZdZd�Zd�Zy)�2CursorTests.test_execute_param_sequence.<locals>.Lc��y)Nr?r@r-s r�__len__z:CursorTests.test_execute_param_sequence.<locals>.L.__len__as��rc��y�NrFr@�r.ris  r�__getitem__z>CursorTests.test_execute_param_sequence.<locals>.L.__getitem__cs��rN�r;r<r=rcrgr@rr�Lra`s��
�
rrir[r\rrFr])r.rirws   r�test_execute_param_sequencez'CursorTests.test_execute_param_sequence_sZ��	�	�	
�����?�@������<�a�c�B��g�g��� ������Q���'rc���Gd�d�}|jjd�|jt�5|jjd|��ddd�y#1swYyxYw)Nc��eZdZd�Zd�Zy)�:CursorTests.test_execute_param_sequence_bad_len.<locals>.Lc��ddzy)Nr?rr@r-s rrczBCursorTests.test_execute_param_sequence_bad_len.<locals>.L.__len__os	���!�rc��t�r")�AssertionError)�slfris  rrgzFCursorTests.test_execute_param_sequence_bad_len.<locals>.L.__getitem__qs��$�$rNrhr@rrrirmns��
�
%rrir[r\)rIr,r`�ZeroDivisionError)r.ris  r�#test_execute_param_sequence_bad_lenz/CursorTests.test_execute_param_sequence_bad_lenlsO��	%�	%�	
�����?�@�
�
�
�0�
1��G�G�O�O�@�!�#�F�2�
1�
1�s�"A&�&A/c�>�d}d}|D]|\}}|j||��5|jt|�5}|jj	||�ddd�|jjt�ddd��~y#1swY�4xYw#1swY��xYw)N))z	select :a�r?)zselect :a, ?, ?�r?r�r@)zselect ?, :b, ?rv)zselect ?, ?, :crv)zselect :a, :b, ?rvzBinding.*is a named parameter�r8�params)r4r5r6rIr,r+r8r9)r.r�r;r8rxr<s      r�%test_execute_named_param_and_sequencez1CursorTests.test_execute_named_param_and_sequencexs���
��.��$�M�E�6����E�&��9��*�*�+=�s�C�r��G�G�O�O�E�6�2�D�� � ����x�8�:�9�%�C�C��:�9�s"�B�B�(B�B�B�B	c�p�dD]�\}}}|j||��5tj�5tjdt�|j
j
||�}|j�\}|j||�ddd�ddd���y#1swY�xYw#1swY��xYw)N))z
select ?1, ?2�r?r�r{)z
select ?2, ?1r{)r�r?rw�error)	r4�warnings�catch_warnings�simplefilterr6rIr,rkr+)r.r8rx�expectedrI�actuals      r�$test_execute_indexed_nameless_paramsz0CursorTests.test_execute_indexed_nameless_params�s���(
�#�E�6�8����E�&��9��,�,�.��)�)�'�3E�F��������7�B� �k�k�m�G�F��$�$�V�X�6�	/�:�9�	(
�
/�.��:�9�s#�B,�AB �
B,� B)�%B,�,B5	c�\�tj}d}t|j|d��5|jjdd�|j
tj|�5|jjdd�ddd�ddd�y#1swY�xYw#1swYyxYw)Nztoo many SQL variablesr?)r$r%zselect * from test where id=?ruz(select * from test where id!=? and id!=?r{)rr�r'rrIr,r"r[)r.r$r;s   r�test_execute_too_many_paramsz(CursorTests.test_execute_too_many_params�s���6�6��&��
�d�g�g���
:��G�G�O�O�;�T�B��'�'��(?�(?��E������ J� &�(�F�;�
:�E�E��;�
:�s#�=B"�(B�B"�B	�B"�"B+c���|jjd�|jjdddi�|jj�}|j|dd�y)Nr[�&select name from test where name=:name�namerFrr]rLs  r�test_execute_dict_mappingz%CursorTests.test_execute_dict_mapping�sP�������?�@������@�6�5�/�R��g�g��� ������Q���'rc��Gd�dt�}|jjd�|jjd|��|jj�}|j	|dd�y)Nc��eZdZd�Zy)�8CursorTests.test_execute_dict_mapping_mapping.<locals>.Dc��yrer@)r.�keys  r�__missing__zDCursorTests.test_execute_dict_mapping_mapping.<locals>.D.__missing__�s��rN)r;r<r=r�r@rr�Dr��s��
rr�r[r�rrF)�dictrIr,rvr+)r.r�rws   r�!test_execute_dict_mapping_mappingz-CursorTests.test_execute_dict_mapping_mapping�s\��	��	�	
�����?�@������@�!�#�F��g�g��� ������Q���'rc���|jjd�|jtj�5|jjdddi�ddd�y#1swYyxYw)Nr[z1select name from test where name=:name and id=:idr�rF�rIr,r`rrer-s r�)test_execute_dict_mapping_too_little_argsz5CursorTests.test_execute_dict_mapping_too_little_args�sM�������?�@�
�
�
�v�6�6�
7��G�G�O�O�O�RX�Z_�Q`�a�8�
7�
7���A#�#A,c���|jjd�|jtj�5|jjd�ddd�y#1swYyxYw)Nr[r�r�r-s r�!test_execute_dict_mapping_no_argsz-CursorTests.test_execute_dict_mapping_no_args�sD�������?�@�
�
�
�v�6�6�
7��G�G�O�O�D�E�8�
7�
7���A � A)c���|jjd�|jtj�5|jjdddi�ddd�y#1swYyxYw)Nr[r\r�rFr�r-s r�!test_execute_dict_mapping_unnamedz-CursorTests.test_execute_dict_mapping_unnamed�sJ�������?�@�
�
�
�v�6�6�
7��G�G�O�O�@�6�5�/�R�8�
7�
7�r�c�8�|jj�yr")rIrMr-s rrdzCursorTests.test_close�rOrc�(�|jjd�|jjd�|jjd�|jjd�|j|jjd�y)Nr0r[zupdate test set name='bar'r��rIr,r+�rowcountr-s r�test_rowcount_executez!CursorTests.test_rowcount_execute�s`�������*�+������?�@������?�@������4�5�������)�)�1�-rc��	|jjd�|j|jjd�y)Nzselect 5 union select 6r�r�r-s r�test_rowcount_selectz CursorTests.test_rowcount_select�s4��	�
	
�����1�2�������)�)�2�.rc���|jjd�|jjdgd��|j|jjd�y)Nr0rD�ru)r��r@r@)rIr,rlr+r�r-s r�test_rowcount_executemanyz%CursorTests.test_rowcount_executemany�sC�������*�+������?�AS�T�������)�)�1�-r)r@�#rzRequires SQLite 3.35.0 or newerc���|jjd�|j|jj�dd�|j|jjd�y)Nz7update test set name='bar' where name='foo' returning 1rr?)rIr,r+rvr�r-s r�test_rowcount_update_returningz*CursorTests.test_rowcount_update_returning�sQ��	
�����Q�R�������)�)�+�A�.��2�������)�)�1�-rc��|jjd�|j|jjd�|jjd�|j|jjd�|jjd�|j|jjd�y)NzW
            -- foo
            insert into test(name) values ('foo'), ('foo')
        r�z�
            /* -- messy *r /* /* ** *- *--
            */
            /* one more */ insert into test(name) values ('messy')
        r?z5/* bar */ update test set name='bar' where name='foo'r@r�r-s r�#test_rowcount_prefixed_with_commentz/CursorTests.test_rowcount_prefixed_with_comment�s���������	
�	
������)�)�1�-�������	
�
	
������)�)�1�-������O�P�������)�)�1�-rc�B�d}|jjd|�|j|jjd�|jj�|jj
d�|j|jjd�y)Nr�z"insert into test(income) values(?)r@�vacuumr�)rIrlr+r�rrRr,)r.r�s  r�test_rowcount_vaccuumz!CursorTests.test_rowcount_vaccuum�sn��!�������@�$�G�������)�)�1�-�������������!�������)�)�2�.rc��|jjd�|jjd�|jd|jjd��y)Nr[r�z"total changes reported wrong value)r;)rIr,�
assertLessrr�r-s r�test_total_changeszCursorTests.test_total_changes�sA�������?�@������?�@�����4�7�7�0�0�6Z��[rc�x�|jjdtdd�D�cgc]}|f��c}�ycc}w)NrD�d�n)rIrlr�rfs  r�test_execute_many_sequencez&CursorTests.test_execute_many_sequence�s7�������A�RW�X[�]`�Ra�Cb�Ra�Q�Q�D�Ra�Cb�c��Cbs�
7
c�Z�Gd�d�}|jjd|��y)Nc��eZdZd�Zd�Zd�Zy)�6CursorTests.test_execute_many_iterator.<locals>.MyIterc��d|_y�N�)�valuer-s rr�z?CursorTests.test_execute_many_iterator.<locals>.MyIter.__init__s	����
rc��|Sr"r@r-s r�__iter__z?CursorTests.test_execute_many_iterator.<locals>.MyIter.__iter__s���rc�p�|jdk(rt�|xjdz
c_|jfS)Nr�r?)r��
StopIterationr-s r�__next__z?CursorTests.test_execute_many_iterator.<locals>.MyIter.__next__s-���:�:��#�'�'��J�J�!�O�J� �J�J�=�(rN)r;r<r=r�r�r�r@rr�MyIterr�s��
�
�
)rr�rD�rIrl)r.r�s  r�test_execute_many_iteratorz&CursorTests.test_execute_many_iterators%��	)�	)�	
�����A�6�8�Lrc�L�d�}|jjd|��y)Nc3�6K�td�D]}|f���	y�wr�)r�)�is r�mygenz6CursorTests.test_execute_many_generator.<locals>.mygens�����1�X���d�
��s�rDr�)r.r�s  r�test_execute_many_generatorz'CursorTests.test_execute_many_generators ��	�	
�����A�5�7�Krc��|jt�5|jjddg�ddd�y#1swYyxYw)Nr>r��r`r�rIrlr-s r�test_execute_many_wrong_sql_argz+CursorTests.test_execute_many_wrong_sql_args2��
�
�
�y�
)��G�G����T�F�+�*�
)�
)�s	�=�Ac��|jtj�5|jj	ddg�ddd�y#1swYyxYw)Nzselect ?r�)r`rrerIrlr-s r�test_execute_many_selectz$CursorTests.test_execute_many_selects8��
�
�
�v�6�6�
7��G�G���
�T�F�3�8�
7�
7�s�A�Ac��|jt�5|jjdd�ddd�y#1swYyxYw)NrDr>r�r-s r�test_execute_many_not_iterablez*CursorTests.test_execute_many_not_iterable s1��
�
�
�y�
)��G�G��� E�r�J�*�
)�
)�s	�<�Ac��|jjd�|jjdd�|jjdd�|jjd�g}|jD]}|j|d��|j|dd�|j|dd	�y)
Nr0rA)r�)�zselect id from test order by idrr�r?r�)rIr,rr+)r.�lstrws   r�test_fetch_iterzCursorTests.test_fetch_iter$s��������*�+������9�4�@������9�4�@������9�:����7�7�C��J�J�s�1�v�������Q���#�����Q���#rc���|jjd�|jj�}|j|dd�|jj�}|j|d�y)N�select name from testrrFr]rLs  r�
test_fetchonezCursorTests.test_fetchone0s[�������/�0��g�g��� ������Q���'��g�g��� ������d�#rc�|�|jj�}|j�}|j|d�yr")rrGrvr+)r.�currws   r�test_fetchone_no_statementz&CursorTests.test_fetchone_no_statement7s-���g�g�n�n����l�l�n������d�#rc���|j|jjd�d|j_|jjd�|jjd�|jjd�|jjd�|jjd�|jj	�}|jt|�d�y)Nr?r�r0z#insert into test(name) values ('A')z#insert into test(name) values ('B')z#insert into test(name) values ('C')r�)r+rI�	arraysizer,r��len�r.rps  r�test_array_sizezCursorTests.test_array_size<s���������*�*�A�.������	
�����*�+������=�>������=�>������=�>������/�0��g�g���!������S��1�%rc��|jjd�|jjd�}|jt	|�d�|jjd�}|j|g�y)Nr�r�r?�rIr,r�r+r�r�s  r�test_fetchmanyzCursorTests.test_fetchmanyMs_�������/�0��g�g����$������S��1�%��g�g����$������b�!rc��	|jjd�|jjd��}|jt	|�d�y)Nr�r�)�sizer?r�r�s  r�test_fetchmany_kw_argz!CursorTests.test_fetchmany_kw_argTsA��>������/�0��g�g���S��)������S��1�%rc��|jjd�|jj�}|jt	|�d�|jj�}|j|g�y)Nr�r?)rIr,rkr+r�r�s  r�
test_fetchallzCursorTests.test_fetchallZs[�������/�0��g�g��� ������S��1�%��g�g��� ������b�!rc�>�|jjgd��y)N)r@r�r�)rI�
setinputsizesr-s r�test_setinputsizeszCursorTests.test_setinputsizesas�������i�(rc�<�|jjdd�y)Nr�r�rI�
setoutputsizer-s r�test_setoutputsizezCursorTests.test_setoutputsizeds�������a��#rc�:�|jjd�yr=r�r-s r�test_setoutputsize_no_columnz(CursorTests.test_setoutputsize_no_columngs�������b�!rc�d�|j|jj|j�yr")r+rI�
connectionrr-s r�test_cursor_connectionz"CursorTests.test_cursor_connectionjs ��������+�+�T�W�W�5rc��|jt�5d�}|jj|�}ddd�y#1swYyxYw)Nc��yr"r@r@rr�fz1CursorTests.test_wrong_cursor_callable.<locals>.fps��Tr)r`r�rrG)r.r�r�s   r�test_wrong_cursor_callablez&CursorTests.test_wrong_cursor_callablens1��
�
�
�y�
)���'�'�.�.��#�C�*�
)�
)�s	�>�Ac��Gd�d�}|�}|jt�5tj|�}ddd�y#1swYyxYw)Nc��eZdZy)�0CursorTests.test_cursor_wrong_class.<locals>.FooN�r;r<r=r@rr�Foor�ts�rr�)r`r�r�Cursor)r.r�rFr�s    r�test_cursor_wrong_classz#CursorTests.test_cursor_wrong_classss6�����e��
�
�
�y�
)��-�-��$�C�*�
)�
)�s�A�Ac��	d}dD]n}|j|��5|jj|j|�d�|j	|jj
d�ddd��py#1swY�{xYw)Nz+{} INTO test(id, unique_test) VALUES (?, ?))zINSERT OR REPLACE�REPLACE��	statement)r?rFr?)r4rIr,�formatr+rK)r.rors   r�test_last_row_id_on_replacez'CursorTests.test_last_row_id_on_replaceysj��	�<��9�I����	��2�������
�
�9� 5�z�B�� � ����!2�!2�A�6�3�2�:�2�2�s�AA8�8B	c��|jjdd�|j|jjd�|jjdd�|j|jjd�y)Nz2insert or ignore into test(unique_test) values (?))�testr�)rIr,r+rKr-s r�test_last_row_id_on_ignorez&CursorTests.test_last_row_id_on_ignore�sf�������@��	�	
������*�*�A�.������@��	�	
������*�*�A�.rc�h�g}dD]�}d}|jdj|���5|jj|j|�|f�|j	||jj
f�|j
tj�5|jj|j|�|f�ddd�|j	||jj
f�ddd���gd�}|j||�y#1swY�QxYw#1swY��,xYw)N)�FAIL�ABORT�ROLLBACKz.INSERT OR {} INTO test(unique_test) VALUES (?)zINSERT OR {}r)�rr�r�r	r@r�r
r�r
)
r4rrIr,rrKr`rr_r+)r.�resultsrror�s     r�test_last_row_id_insert_o_rz'CursorTests.test_last_row_id_insert_o_r�s�����6�I�B�C�����(=�(=�i�(H��I�������
�
�9� 5�	�|�D����	�4�7�7�+<�+<�=�>��&�&�v�'<�'<�=��G�G�O�O�C�J�J�y�$9�I�<�H�>����	�4�7�7�+<�+<�=�>�J�I�7�
��
	
����(�+�>�=��J�I�s$�A3D'�-D�/D'�D$� D'�'D1	c�(�d}|jj|�}t|j�}|jjd�|jj|�}t|j�}|j	||z
d�y)Nzselect * from testzalter table test add newcolr?)rIr,r��descriptionr+)r.�selectrp�	old_count�	new_counts     r�test_column_countzCursorTests.test_column_count�sm��%���g�g�o�o�f�%������(�	������5�6��g�g�o�o�f�%������(�	�����Y�.��2rc��td�D�cgc]}|jjd���}}|D]#}|j|j	�dg��%ycc}w)Nr@r2ru)r�rr,r+rk)r.�_�cursorsrIs    r�#test_same_query_in_multiple_cursorsz/CursorTests.test_same_query_in_multiple_cursors�sO��8=�a��A��1�4�7�7�?�?�:�.���A��B����R�[�[�]�T�F�3���Bs�"AN)Ar;r<r=rJrNr2r4r9r;r?rBrErHrMrOrSrVrYr^rjrsryr�r�r�r�r�r�r�rdr�r�r�r>r?rrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr@rrr)r)�s]��G��,�+�+�,'�" �B�K�H�-�R�
M�
?�
?�
(�(�
G�
9�7�(�(�(�b�
F�
S�
�.�/�.�
�X�_�_�V�/�/�*�<�6�8�.�8�.�.� /�\�d�M�"L�,�4�K�
$�$�$�
&�""�&�"�)�$�"�6�$�
%�7�/�,�"	3�4rr)c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*y))*�	BlobTestsc��tjd�|_|jjd�d|_|jjd|jf�|jjddd�|_y)Nr�create table test(b blob)s2this blob data string is exactly fifty bytes long!zinsert into test(b) values (?)rr�r?)rrrr,r��blobopen�blobr-s rrJzBlobTests.setUp�s]���.�.��,��������3�4�I��	������8�4�9�9�,�G��G�G�$�$�V�S�!�4��	rc�l�|jj�|jj�yr")rrMrr-s rrNzBlobTests.tearDown�s���	�	�������
�
�rc�X�|j|jtj�yr")�assertIsInstancerrr4r-s r�test_blob_is_a_blobzBlobTests.test_blob_is_a_blob�s�����d�i�i����5rc�J�|jjd�|j|jj�d�|jjdt�|j|jj�d�|jjdt
�|j|jj�d�|jjdt�|j|jj�d�y)Nr������()r�seekr+�tellrrr
r-s r�test_blob_seek_and_tellz!BlobTests.test_blob_seek_and_tell�s����	�	���r����������)�2�.��	�	���r�8�$���������)�2�.��	�	���r�8�$���������)�2�.��	�	���s�H�%���������)�2�.rc�x��d}d}d}t|�fd�ft|�fd�ft|�fd�ft|�fd�ff}|D]6\}}}�j|||��5�j|||�ddd��8�jj	d	t
��jt|�5�jj	tt�ddd��jt|�5�jj	tt�ddd�y#1swY��xYw#1swY�YxYw#1swYyxYw)
Nzoffset out of blob rangez;'origin' should be os.SEEK_SET, os.SEEK_CUR, or os.SEEK_ENDzseek offset results in overflowc�:���jjd�S)N���rr(r-s�rrjz0BlobTests.test_blob_seek_error.<locals>.<lambda>�s���$�)�)�.�.��*>rc�:���jjd�S)Nr&r.r-s�rrjz0BlobTests.test_blob_seek_error.<locals>.<lambda>�s���$�)�)�.�.��*=rc�<���jjdd�S)Nr�r�r.r-s�rrjz0BlobTests.test_blob_seek_error.<locals>.<lambda>�s���4�9�9�>�>�"�b�+Arc�<���jjdd�S)Nr�r@r.r-s�rrjz0BlobTests.test_blob_seek_error.<locals>.<lambda>�s���4�9�9�>�>�"�a�+@r)r/r;�fnr?)
r�r4r"rr(r�
OverflowErrorr	rr
)r.�msg_oor�msg_orig�msg_ofr�r/r;r2s`       r�test_blob_seek_errorzBlobTests.test_blob_seek_error�s���,��P��2����">�?�
��"=�>�
��#A�B�
��#@�A�	
��$�L�C��b����#�3�2��6��&�&�s�C��4�7�6�$�
	
�	�	���q�(�#�
�
#�
#�M�6�
:��I�I�N�N�7�H�-�;�
�
#�
#�M�6�
:��I�I�N�N�7�H�-�;�
:�7�6��
;�
:��
:�
:�s$�D�'%D$�*%D0�D!	�$D-�0D9c�p�|jj�}|j||j�yr")r�readr+r��r.�bufs  r�test_blob_readzBlobTests.test_blob_read�s&���i�i�n�n�������d�i�i�(rc��|jjt|j�dz�}|j	||j�y)Nr�)rr9r�r�r+r:s  r�test_blob_read_oversizedz"BlobTests.test_blob_read_oversized�s5���i�i�n�n�S����^�a�/�0������d�i�i�(rc���d}|jj|�}|j||jd|�|j|jj	�|�y)Nr�)rr9r+r�r))r.r�r;s   r�test_blob_read_advance_offsetz'BlobTests.test_blob_read_advance_offset�sN�����i�i�n�n�Q�������d�i�i���m�,���������)�1�-rc��|jjd�|j|jjd�|jdd�y)Nr�r%)rr(r+r9r�r-s r�test_blob_read_at_offsetz"BlobTests.test_blob_read_at_offset�s:���	�	���r�����������+�T�Y�Y�r�"�-=�>rc���|jjd�|jtj�5|j
j
�ddd�y#1swYyxYw)N�&update test set b='aaaa' where rowid=1)rr,r`rr[rr9r-s r� test_blob_read_error_row_changedz*BlobTests.test_blob_read_error_row_changed�sA�������@�A�
�
�
�v�6�6�
7��I�I�N�N��8�
7�
7�s�A�A(c���djd�}|jj|�|jj	d�j�}|j
|d|�y)Nsnew data�2�select b from testr)�ljustr�writerr,rvr+�r.�new_datarws   r�test_blob_writezBlobTests.test_blob_write�sR���$�$�R�(���	�	����!��g�g�o�o�2�3�<�<�>������Q���*rc��d}|jjd�|jj|�|jj	d�j�}|j
|d|jdd|z�y)Nscccccccccccccccccccccccccr	rHr)rr(rJrr,rvr+r�rKs   r�test_blob_write_at_offsetz#BlobTests.test_blob_write_at_offset�sf�����	�	���r���	�	����!��g�g�o�o�2�3�<�<�>������Q�����3�B��(�!:�;rc��|jjd�|j|jj�d�y)Ns
ddddddddddr�)rrJr+r)r-s r�test_blob_write_advance_offsetz(BlobTests.test_blob_write_advance_offsets-���	�	���� ���������)�2�.rc��|jtd�5|jjd�ddd�|jj	dt
�t
|j�}|jjd|dz
z�|jjd�|jtd�5|jjd�ddd�y#1swY��xYw#1swYyxYw)Nzdata longer than blob��aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar�ar?)r"r�rrJr(rr�)r.r�s  r�test_blob_write_error_lengthz&BlobTests.test_blob_write_error_length	s���
�
#�
#�J�0G�
H��I�I�O�O�K�(�I�	
�	�	���q�(�#���	�	�N���	�	�����!���%��	�	�����
�
#�
#�J�0G�
H��I�I�O�O�D�!�I�
H�I�
H��I�
H�s�C'�C3�'C0�3C<c���|jjd�|jtj�5|j
j
d�ddd�y#1swYyxYw)NrD�aaa)rr,r`rr[rrJr-s r�!test_blob_write_error_row_changedz+BlobTests.test_blob_write_error_row_changedsC�������@�A�
�
�
�v�6�6�
7��I�I�O�O�F�#�8�
7�
7�r�c���|jjdddd��}|jtjd�5|jd�ddd�|j
�y#1swY�xYw)Nrr�r?T)�readonlyrZrW)rrr"rr[rJrM)r.�ro_blobs  r�test_blob_write_error_readonlyz(BlobTests.test_blob_write_error_readonlysZ���'�'�"�"�6�3��D�"�A��
�
#�
#�F�$;�$;�Z�
H��M�M�&�!�I��
�
��I�
H�s�A+�+A4c�.�dddifdifdifdiff}d}|D]f\}}|j||��5|jtj|�5|jj
|i|��ddd�ddd��hy#1swY�xYw#1swY�xYw)	N)rr�r?r��notexisting)r^r�r?)rr^r?)rr�r�zno such)r�kwds)r4r"rr[rr)r.r�r�rr_s     r�test_blob_open_errorzBlobTests.test_blob_open_errors���
��
�6�7�
$�b�)�
'��,�
�r�"�	
����!�J�D�$����4�d��3��+�+�F�,C�,C�U�K�$�D�G�G�$�$�d�3�d�3�L�4�3�"�K�K��4�3�s#�!B�A?�,B�?B�B�B	c�N�|jt|j�d�y)NrG)r+r�rr-s r�test_blob_lengthzBlobTests.test_blob_length,s������T�Y�Y���,rc��|j|jdtd��|j|jdtd��|j|jdtd��|j|jdtd��|j|jdtd	��y)
Nr�r�r��lr��or�r��!)r+r�ordr-s r�test_blob_get_itemzBlobTests.test_blob_get_item/s���������1��s�3�x�0�������1��s�3�x�0�������1��s�3�x�0�������1��s�3�x�0�������2���C��1rc���td�|jd<d|jddz}|jj	d�j�d}|j
||�y)Nr�r�br?rH)rgrr�rr,rvr+�r.r�r�s   r�test_blob_set_itemzBlobTests.test_blob_set_item6sX���3�x��	�	�!���$�)�)�A�B�-�'�������!5�6�?�?�A�!�D�������*rc��|jjdt�|j|jj	�d�td�|jd<td�|jd<|jjdt�d}|j|jj	�|�y)Nrr�T�.r�s2This blob data string is exactly fifty bytes long.)rr(r
r+r9rgr)r.r�s  r�test_blob_set_item_with_offsetz(BlobTests.test_blob_set_item_with_offset<s����	�	���q�(�#���������)�3�/��3�x��	�	�!���C���	�	�"�
��	�	���q�(�#�H����������)�8�4rc�Z�ddlm}td�|jdd|j|jddd�t	d�|jdd|j|jddd�|dgd��|jdd|j|jddd�y)	Nr)�array�12345r�s23456r�)r?r�r@r�r�s)rrr�rr+�	bytearray)r.rrs  r�!test_blob_set_slice_buffer_objectz+BlobTests.test_blob_set_slice_buffer_objectEs����#�H�-��	�	�!�A��������1�Q���2�"�8�,��	�	�!�A��������1�Q���2��s�O�4��	�	�!�A��������1�Q��)@�Arc�`�d|jd<|j|jdd�y)N�r�)rr+r-s r�!test_blob_set_item_negative_indexz+BlobTests.test_blob_set_item_negative_indexPs'����	�	�"�
�������2���,rc�B�|j|jddd�y)Nr�r�s	blob data�r+rr-s r�test_blob_get_slicezBlobTests.test_blob_get_sliceTs��������1�R��,�7rc�B�|j|jddd�y)Nr�rrzr-s r�test_blob_get_empty_slicez#BlobTests.test_blob_get_empty_sliceWs��������1�Q���-rc�\�|j|jdd|jdd�y)Nr����)r+rr�r-s r�"test_blob_get_slice_negative_indexz,BlobTests.test_blob_get_slice_negative_indexZs&��������1�R��$�)�)�A�b�/�:rc�H�|j|jddd�d�y)Nrr�r�sti lbrzr-s r�test_blob_get_slice_with_skipz'BlobTests.test_blob_get_slice_with_skip]s!��������1�R��6�*�H�5rc���d|jddd|jddz}|jjd�j	�d}|j||�y)Nrsrr�rH)rr�rr,rvr+rks   r�test_blob_set_slicezBlobTests.test_blob_set_slice`sV��!��	�	�!�A���d�i�i���m�+�������!5�6�?�?�A�!�D�������*rc�t�d|jdd|j|jdd|j�y)Nrr)rr+r�r-s r�test_blob_set_empty_slicez#BlobTests.test_blob_set_empty_slicefs-����	�	�!�A��������1��t�y�y�1rc���d|jddd�<|jjd�j�d}d|jddz}|j||�y)Nrsrr�r�rHs
1h2s3b4o5 )rrr,rvr�r+)r.r�r�s   r�test_blob_set_slice_with_skipz'BlobTests.test_blob_set_slice_with_skipjs[��$��	�	�!�B�q�&�������!5�6�?�?�A�!�D�� �4�9�9�R�S�>�1�������*rc�d�d}|jt|�5|jddddd�|jt|�5|jdddd�|jt|�5d|jd<ddd�y#1swY�fxYw#1swY�DxYw#1swYyxYw)Nzindices must be integersr�g@g�?rjr��r"r�r)r.r;s  r�$test_blob_mapping_invalid_index_typez.BlobTests.test_blob_mapping_invalid_index_typeps���(��
�
#�
#�I�s�
3��I�I�a���4�
�
#�
#�I�s�
3��I�I�c�N�4�
�
#�
#�I�s�
3�!�D�I�I�c�N�4�
3�	4�
3��
3�
3��
3�
3�s#�B�B�5B&�B�B#�&B/c�<�t|j�ddg}|D]K}|j|��5|jtd�5|j|ddd�ddd��M|jtd�5|jt
ddd�|jjd�|jtj�5|jdddd�y#1swY��xYw#1swY��xYw#1swY�txYw#1swYyxYw)N�ii����)�idxzindex out of rangezcannot fit 'int'rDr)r�rr4r"�
IndexErrorr
rr,r`rr[)r.r�r�s   r�test_blob_get_item_errorz"BlobTests.test_blob_get_item_errorys����t�y�y�>�3��-���C����#��&��+�+�J�8L�M��I�I�c�N�N�'�&���
#�
#�J�0B�
C��I�I�j�!�D�	
�����@�A�
�
�
�v�6�6�
7��I�I�a�L�8�
7�N�M��'�&��D�
C��
8�
7�s;�C:�C.�C:�?D�D�.C7�3C:�:D	�D�Dc��|jtd�5d|jd<ddd�|jtd�5d|jd<ddd�|jtd�5td�|jd<ddd�|jtd�5|jd=ddd�|jtd�5d|jd<ddd�|jt
d�5d	|jd<ddd�|jt
d�5d
|jd<ddd�|jt
d�5ddz|jd<ddd�y#1swY��WxYw#1swY��6xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swYyxYw)
Nzcannot be interpretedsmultiplerr��doesn't support.*deletionzBlob index out of ranger-zmust be in ranger��r��A)r"r�rrtr�r�r-s r�test_blob_set_item_errorz"BlobTests.test_blob_set_item_error�sk��
�
#�
#�I�/F�
G�&�D�I�I�a�L�H�
�
#�
#�I�/F�
G��D�I�I�a�L�H�
�
#�
#�I�/F�
G�$�T�?�D�I�I�a�L�H�
�
#�
#�I�/J�
K��	�	�!��L�
�
#�
#�J�0I�
J��D�I�I�d�O�K�
�
#�
#�J�0B�
C��D�I�I�a�L�D�
�
#�
#�J�0B�
C��D�I�I�a�L�D��
#�
#�J�0B�
C��b�5�D�I�I�a�L�D�
C�H�
G��
G�
G��
G�
G��
K�
K��
J�
J��
C�
C��
C�
C��D�
C�s_�E<�F	�3F�*F#�F/�F;�2G� G�<F�	F�F �#F,�/F8�;G�G�Gc�j�|jtd�5d|jddddd�|jtd�5d|jddddd�|jtd�5|jdd�=ddd�|jtd�5d|jddd	�<ddd�|jt�5td
�ddd�|jddddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY�jxYw#1swYyxYw)Nz
wrong sizerTr�r�rSr�zstep cannot be zerorsrsabcder�)r"r�rr�r�r`r�r�r-s r�test_blob_set_slice_errorz#BlobTests.test_blob_set_slice_error�s���
�
#�
#�J��
=�"�D�I�I�a��O�>�
�
#�
#�J��
=�)�D�I�I�a��O�>�
�
#�
#�I�/J�
K��	�	�!�B�$��L�
�
#�
#�J�0E�
F� (�D�I�I�a��1�f��G�
�
�
�{�
+�(��2�3�Q�3�7�D�I�I�a��O�,�
+�>�
=��
=�
=��
K�
K��
F�
F��
+�
+�s;�C9�D�3D�!D�D)�9D�D�D�D&�)D2c�r�|jtd�5|j|jzddd�|jtd�5|jdzddd�|jtd�5d|jvddd�y#1swY�exYw#1swY�CxYw#1swYyxYw)Nzunsupported operandr�zis not iterablerTr�r-s r� test_blob_sequence_not_supportedz*BlobTests.test_blob_sequence_not_supported�s���
�
#�
#�I�/D�
E��I�I��	�	�!�F�
�
#�
#�I�/D�
E��I�I��M�F�
�
#�
#�I�/@�
A��D�I�I��B�
A�	F�
E��
E�
E��
A�
A�s#�B�B!�=B-�B�!B*�-B6c��d}|jjddd�5}|j|�ddd�|jjd�j	�d}|j||�|j
tjd�5j�ddd�y#1swY��xYw#1swYyxYw)Ns2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarr�r?rHrzclosed blob)
rrrJr,rvr+r"rrer9)r.r�rr�s    r�test_blob_context_managerz#BlobTests.test_blob_context_manager�s�����
�W�W�
�
�f�c�1�
-���J�J�t��.������!5�6�?�?�A�!�D�������&��
#�
#�F�$;�$;�]�
K��I�I�K�L�
K�
.�
-��L�
K�s�B2�B>�2B;�>Cc���Gd�dt�}|j|d�5|jjddd�5}|d��#1swYnxYw	ddd�y#1swYyxYw)Nc��eZdZy)�NBlobTests.test_blob_context_manager_reraise_exceptions.<locals>.DummyExceptionNr�r@rr�DummyExceptionr��s��rr��reraisedrr�r?)rLr"rr)r.r�rs   r�,test_blob_context_manager_reraise_exceptionsz6BlobTests.test_blob_context_manager_reraise_exceptions�sZ��	�Y�	�
�
#�
#�N�J�
?����!�!�&�#�q�1�T�$�Z�0�0�2�1��1�@�
?�
?�s�A�	A	�	A	�A�A(c��t�5}|jd�|jd�|jddd�}|j�d}|j	t
j|�5|j�ddd�|j	t
j|�5|jd�ddd�|j	t
j|�5|jd�ddd�|j	t
j|�5|j�ddd�|j	t
j|�5|j�ddd�|j	t
j|�5|jddd�ddd�|j	t
j|�5t|�ddd�|j	t
j|�5|dddd�|j	t
j|�5|ddddd�|j	t
j|�5d|d<ddd�ddd�y#1swY���xYw#1swY���xYw#1swY���xYw#1swY��mxYw#1swY��AxYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swYyxYw)	Nrz'insert into test values (zeroblob(100))rr�r?zCannot operate on a closed blobrr)rr,rrMr"rrer9rJr(r)�	__enter__�__exit__r�)r.rrr;s    r�test_blob_closedzBlobTests.test_blob_closed�s��
�
�"��J�J�2�3��J�J�@�A��;�;�v�s�A�.�D��J�J�L�3�C��'�'��(?�(?��E��	�	��F��'�'��(?�(?��E��
�
�3��F��'�'��(?�(?��E��	�	�!��F��'�'��(?�(?��E��	�	��F��'�'��(?�(?��E���� �F��'�'��(?�(?��E��
�
�d�D�$�/�F��'�'��(?�(?��E��D�	�F��'�'��(?�(?��E��Q��F��'�'��(?�(?��E��Q�q�	�F��'�'��(?�(?��E���Q��F�3�
�F�E��E�E��E�E��E�E��E�E��E�E��E�E��E�E��E�E��E�E��3�
�s��A(K3�3I5�(K3�,J�>(K3�&J�8(K3� J�1(K3�J)�*(K3�J6�&(K3�K�(K3�K�(K3�0K�6(K3�K'�$K3�5I?	�:K3�J	�K3�J	�K3�J&	�!K3�)J3	�.K3�6K	�;K3�K	�K3�K	�K3�K$	� K3�'K0	�,K3�3K<c�"�t�5}|jd�|jd�|jddd�}|j�|j	t
jd|j�ddd�y#1swYyxYw)Nrz*insert into test(b) values (zeroblob(100))rr�r?z#Cannot operate on a closed database)rr,rrMr"rrer9)r.rrs   r�test_blob_closed_db_readz"BlobTests.test_blob_closed_db_read�sk��
�
�"��J�J�2�3��J�J�C�D��;�;�v�s�A�.�D��H�H�J��"�"�6�#:�#:�#H�#'�9�9�
.��
�
�s�A1B�Bc��t�5}d}|jd�|jd|f�|jdd|�ddd�y#1swYyxYw)Nlzcreate table t(t blob)z/insert into t(rowid, t) values (?, zeroblob(1))rf)rr,r)r.r�rowids   r�test_blob_32bit_rowidzBlobTests.test_blob_32bit_rowid�sI��
�
�"��E��J�J�/�0��J�J�H�5�(�S��K�K��S�%�(�	�
�
�s�:A�AN)+r;r<r=rJrNr#r*r7r<r>r@rBrErMrOrQrUrXr\r`rbrhrlrprurxr{r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r@rrrr�s���5��6�/�.�,)�)�.�?��
+�<�/�	"�$�
�4�-�2�+�5�	B�-�8�.�;�6�+�2�+�"��!�&
8��	�1��:.�)rrc�l�eZdZd�Zd�Zejd��Zd�Zd�Z	ejd��Z
y)�ThreadTestsc���tjd�|_|jj�|_|jjd�|jjd�y)Nrz$create table test(name text, b blob)z,insert into test values('blob', zeroblob(1)))rrr-rGr�r,r-s rrJzThreadTests.setUp�sJ���>�>�*�-����8�8�?�?�$��������?�@������G�Hrc�l�|jj�|jj�yr")r�rMr-r-s rrNzThreadTests.tearDown�s�������������rc���������fd�}g}tj|d|i��}|j�|j�|r!|j	dj|��yy)Nc���	��i���|jd�y#tj$rYy|jd�YyxYw)Nzdid not raise ProgrammingErrorzraised wrong exception)rrre)�errrr2r_s ���r�runz"ThreadTests._run_test.<locals>.run�sG���
5��D�!�D�!��
�
�;�<���*�*�
��
5��
�
�3�4�s��A�Ar���targetr�
)�	threading�Thread�start�join�fail)r.r2rr_r�r�rfs ```   r�	_run_testzThreadTests._run_test�sS���	5������C����=��	���	�	������I�I�d�i�i��n�%�rc����fd��fd��fd��fd��fd��fd��fd��fd��fd	��fd
�g
}ttjd�r(|j�fd��|j�fd
��tjdk\r|j�fd��|D].}�j|��5�j
|�ddd��0y#1swY�;xYw)Nc�8���jj�Sr")r-rGr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>����D�H�H�O�O�%rc�8���jj�Sr")r-rRr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>r�rc�8���jj�Sr")r-rXr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>����D�H�H�%�%�'rc�8���jj�Sr")r-rMr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>����D�H�H�N�N�$rc�:���jjd�Sr")r-�set_trace_callbackr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>s���D�H�H�/�/��5rc�:���jjd�Sr")r-�set_authorizerr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>s���D�H�H�+�+�D�1rc�<���jjdd�Sre)r-�create_collationr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>s���D�H�H�-�-�e�T�:rc�X���jjtjd�S)Nr�)r-r#rr�r-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>s���D�H�H�%�%�f�&@�&@�"�Erc�V���jjtj�Sr")r-r�rr�r-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>s���D�H�H�%�%�f�&@�&@�Arc�>���jjddd�S)Nrr�r?)r-rr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>s���D�H�H�%�%�f�c�1�5rr�c�8���jj�Sr")r-r�r-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>s���t�x�x�1�1�3rc�:���jjd�S)Nr)r-r�r-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda>s���t�x�x�3�3�C�8rrc�>���jjddd�S)NrFr)r-�create_window_functionr-s�rrjz:ThreadTests.test_check_connection_thread.<locals>.<lambda> s���t�x�x�>�>�u�a��Nr�r2)rrr�rrr4r��r.�fnsr2s`  r�test_check_connection_threadz(ThreadTests.test_check_connection_threads����%�%�'�$�5�1�:�E�A�5�
���6�$�$�k�2��J�J�3�4��J�J�8�9��%�%��3��J�J�N�O��B������$����r�"�%�$��$�$�s�,C	�	C	c����fd��fd��fd��fd�g}|D].}�j|��5�j|�ddd��0y#1swY�;xYw)Nc�:���jjd�S)Nz"insert into test(name) values('a')�r�r,r-s�rrjz6ThreadTests.test_check_cursor_thread.<locals>.<lambda>(s���D�H�H�$�$�%I�Jrc�8���jj�Sr")r�rMr-s�rrjz6ThreadTests.test_check_cursor_thread.<locals>.<lambda>)r�rc�:���jjd�S)Nr�r�r-s�rrjz6ThreadTests.test_check_cursor_thread.<locals>.<lambda>*s���D�H�H�$�$�%<�=rc�8���jj�Sr")r�rvr-s�rrjz6ThreadTests.test_check_cursor_thread.<locals>.<lambda>+r�rr�)r4r�r�s`  r�test_check_cursor_threadz$ThreadTests.test_check_cursor_thread&sK���J�$�=�'�	
���B������$����r�"�%�$��$�$�s�A�A	c��d�}tjdd��}g}tj|||d���}|j	�|j�|j
t|�ddj|��y)	Nc�|�	|jd�y#tj$r|jd�YywxYw)Nr2zmulti-threading not allowed)r,rrOr�r-r�s  rr�z4ThreadTests.test_dont_check_same_thread.<locals>.run4s3��
:����J�'���<�<�
:��
�
�8�9�
:�s��$;�;rF)�check_same_threadr�r�rr�)rrr�r�r�r�r+r�)r.r�r-r�rfs     r�test_dont_check_same_threadz'ThreadTests.test_dont_check_same_thread2se��	:��n�n�Z�5�A�������C��C�0H�I��	���	�	��������S��1�d�i�i��n�5rN)r;r<r=rJrNr�reap_threadsr�r�r�r�r@rrr�r��sK��I���"�"�&�#�&�"#�.	#��"�"�6�#�6rr�c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�ConstructorTestsc�2�tjddd�}y)N��r��)r�Date�r.r�s  r�	test_datezConstructorTests.test_dateCs���K�K��b�"�%�rc�2�tjddd�}y)N��'r�)r�Time�r.rfs  r�	test_timezConstructorTests.test_timeFs���K�K��B��#�rc�8�tjdddddd�}y)Nr�r�r�r�r�r�)r�	Timestamp�r.�tss  r�test_timestampzConstructorTests.test_timestampIs��
�
�
�d�B��B��B�
7�rc�.�tjd�}yr=)r�
DateFromTicksr�s  r�test_date_from_ticksz%ConstructorTests.test_date_from_ticksL���� � ��$�rc�.�tjd�}yr=)r�
TimeFromTicksr�s  r�test_time_from_ticksz%ConstructorTests.test_time_from_ticksOr�rc�.�tjd�}yr=)r�TimestampFromTicksr�s  r�test_timestamp_from_ticksz*ConstructorTests.test_timestamp_from_ticksRs��
�
&�
&�r�
*�rc�.�tjd�}y)Ns')r�Binary)r.r�s  r�test_binaryzConstructorTests.test_binaryUs���M�M�&�!�rN)
r;r<r=r�r�r�r�r�r�rr@rrr�r�Bs%��&�$�8�%�%�+�"rr�c�N�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�ExtensionTestsc���tjd�}|j�}|jd�|j	d�|j�d}|j
|d�y)Nrz�
            -- bla bla
            /* a stupid comment */
            create table a(i);
            insert into a(i) values (5);
            zselect i from arr�)rrrGrmr,rvr+)r.r-r�rps    r�test_script_string_sqlz%ExtensionTests.test_script_string_sqlYs]���n�n�Z�(���j�j�l������	�	���%�&��l�l�n�Q�������a� rc���tjd�}|j�}|jtj�5|jd�ddd�y#1swYyxYw)Nrz1create table test(x); asdf; create table test2(x)�rrrGr`r[rm�r.r-r�s   r�test_script_syntax_errorz'ExtensionTests.test_script_syntax_errorfsJ���n�n�Z�(���j�j�l��
�
�
�v�6�6�
7����Q�R�8�
7�
7���A � A)c���tjd�}|j�}|jtj�5|jd�ddd�y#1swYyxYw)Nrz5create table test(sadfsadfdsa); select foo from hurz;rrs   r�test_script_error_normalz'ExtensionTests.test_script_error_normallsJ���n�n�Z�(���j�j�l��
�
�
�v�6�6�
7����U�V�8�
7�
7�r
c���tjd�}|j�}|jt�5|jd�ddd�y#1swYyxYw)Nrs9create table test(foo); insert into test(foo) values (5);)rrrGr`r�rmrs   r�"test_cursor_executescript_as_bytesz1ExtensionTests.test_cursor_executescript_as_bytesrsD���n�n�Z�(���j�j�l��
�
�
�y�
)����Z�[�*�
)�
)���A�Ac���tjd�}|j�}|jt�5|jd�ddd�y#1swYyxYw)Nrzb
                create table a(i);
                insert into a(i) values (5);
                )rrrGr`r�rmrs   r�.test_cursor_executescript_with_null_charactersz=ExtensionTests.test_cursor_executescript_with_null_charactersxsH���n�n�Z�(���j�j�l��
�
�
�z�
*�����
�+�
*�
*�rc���tjd�}|j�}|jt�5|jd�ddd�y#1swYyxYw)Nrue
                create table a(s);
                insert into a(s) values ('�');
                )rrrGr`�UnicodeEncodeErrorrmrs   r�)test_cursor_executescript_with_surrogatesz8ExtensionTests.test_cursor_executescript_with_surrogates�sI���n�n�Z�(���j�j�l��
�
�
�1�
2�����
�3�
2�
2�rc	�v�d}t�5}t|�5}|jdj|��|j	t
j|�5|jdj|dz��ddd�ddd�ddd�y#1swY�xYw#1swY�xYw#1swYyxYw)Nr�zselect 'almost too large'zselect 'too large'r?)rr'rmrIr"rrX)r.r;r�lims    r�*test_cursor_executescript_too_large_scriptz9ExtensionTests.test_cursor_executescript_too_large_script�s���)��
�
�"�h�r�l�c����8�>�>�s�C�D��'�'��(8�(8�#�>�� � �!5�!;�!;�C��E�!B�C�?�'3�
�
�>�>��'3�l��
�
�s;�B/�AB#�$B�>B#�B/�B �B#�#B,	�(B/�/B8c���tjd�}|jd�|j|j�|jd�|j
|j�y)Nr�beginr2)rrr,rIrurmr8�r.r-s  r�$test_cursor_executescript_tx_controlz3ExtensionTests.test_cursor_executescript_tx_control�sP���n�n�Z�(�����G������*�*�+����*�%�����+�+�,rc��tjd�}|jd�j�d}|j	|dd�y)Nrzselect 5rr�z Basic test of Connection.execute)rrr,rvr+�r.r-�results   r�test_connection_executez&ExtensionTests.test_connection_execute�s?���n�n�Z�(�����Z�(�1�1�3�A�6�������$F�Grc��tjd�}|jd�|jdddg�|jd�j	�}|j|dddd	�|j|d
ddd	�y)Nrzcreate table test(foo)z insert into test(foo) values (?)r��r�z!select foo from test order by foorr@z$Basic test of Connection.executemanyr?r�)rrr,rlrkr+rs   r�test_connection_executemanyz*ExtensionTests.test_connection_executemany�s~���n�n�Z�(�����,�-����:�T�4�L�I����@�A�J�J�L��������1��q�*P�Q�������1��q�*P�Qrc��tjd�}|jd�|jd�j	�d}|j|dd�y)Nrz9create table test(foo); insert into test(foo) values (5);zselect foo from testrr�z&Basic test of Connection.executescript)rrrmr,rvr+rs   r�test_connection_executescriptz,ExtensionTests.test_connection_executescript�sO���n�n�Z�(�����U�V����3�4�=�=�?��B�������$L�MrN)r;r<r=rr	rrrrrrrr"r$r@rrrrXs@��!�S�W�\���D�-�H�
R�Nrrc�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�ClosedConTestsc���tjd�}|j�|jtj�5|j�}ddd�y#1swYyxYwr)rrrMr`rerGrs   r�test_closed_con_cursorz%ClosedConTests.test_closed_con_cursor�sD���n�n�Z�(���	�	��
�
�
�v�6�6�
7��*�*�,�C�8�
7�
7�r�c���tjd�}|j�|jtj�5|j�ddd�y#1swYyxYwr)rrrMr`rerRrs  r�test_closed_con_commitz%ClosedConTests.test_closed_con_commit�sB���n�n�Z�(���	�	��
�
�
�v�6�6�
7��J�J�L�8�
7�
7�r�c���tjd�}|j�|jtj�5|j�ddd�y#1swYyxYwr)rrrMr`rerXrs  r�test_closed_con_rollbackz'ClosedConTests.test_closed_con_rollback�sB���n�n�Z�(���	�	��
�
�
�v�6�6�
7��L�L�N�8�
7�
7�r�c��tjd�}|j�}|j�|j	tj
�5|j
d�ddd�y#1swYyxYw)Nrzselect 4)rrrGrMr`rer,rs   r�test_closed_cur_executez&ClosedConTests.test_closed_cur_execute�sP���n�n�Z�(���j�j�l���	�	��
�
�
�v�6�6�
7��K�K�
�#�8�
7�
7�s�A0�0A9c���tjd�}|j�d�}|jtj�5|jdd|�ddd�y#1swYyxYw)Nrc��y�Nr�r@rhs rr�z5ClosedConTests.test_closed_create_function.<locals>.f�s��rrFr?)rrrMr`rern)r.r-r�s   r�test_closed_create_functionz*ClosedConTests.test_closed_create_function�sN���n�n�Z�(���	�	���
�
�
�v�6�6�
7�����q�!�,�8�
7�
7�s�A%�%A.c���tjd�}|j�Gd�d�}|jtj�5|jdd|�ddd�y#1swYyxYw)Nrc��eZdZd�Zd�Zd�Zy)�8ClosedConTests.test_closed_create_aggregate.<locals>.Aggc��yr"r@r-s rr�zAClosedConTests.test_closed_create_aggregate.<locals>.Agg.__init__����rc��yr"r@rfs  r�stepz=ClosedConTests.test_closed_create_aggregate.<locals>.Agg.step�r7rc��yr1r@r-s r�finalizezAClosedConTests.test_closed_create_aggregate.<locals>.Agg.finalize�s��rN)r;r<r=r�r9r;r@rr�Aggr5�s��
�
�
rr<rFr?)rrrMr`re�create_aggregate)r.r-r<s   r�test_closed_create_aggregatez+ClosedConTests.test_closed_create_aggregate�sW���n�n�Z�(���	�	��	�	��
�
�v�6�6�
7�� � ���3�/�8�
7�
7�s�A,�,A5c���tjd�}|j�d�}|jtj�5|j|�ddd�y#1swYyxYw)Nrc�"�tjSr")r�DENY)rs r�
authorizerz=ClosedConTests.test_closed_set_authorizer.<locals>.authorizer�s���;�;�r)rrrMr`rer�)r.r-rBs   r�test_closed_set_authorizerz)ClosedConTests.test_closed_set_authorizer�sL���n�n�Z�(���	�	��	�
�
�
�v�6�6�
7����z�*�8�
7�
7�s�A#�#A,c���tjd�}|j�d�}|jtj�5|j|d�ddd�y#1swYyxYw)Nrc��yr"r@r@rr�progresszBClosedConTests.test_closed_set_progress_callback.<locals>.progress�s��rr�)rrrMr`re�set_progress_handler)r.r-rFs   r�!test_closed_set_progress_callbackz0ClosedConTests.test_closed_set_progress_callback�sL���n�n�Z�(���	�	���
�
�
�v�6�6�
7��$�$�X�s�3�8�
7�
7�s�A$�$A-c���tjd�}|j�|jtj�5|�ddd�y#1swYyxYwr)rrrMr`rers  r�test_closed_callzClosedConTests.test_closed_call�s>���n�n�Z�(���	�	��
�
�
�v�6�6�
7��E�8�
7�
7�s�A�AN)r;r<r=r(r*r,r.r2r>rCrHrJr@rrr&r&�s/�����$�-�0�+�4�rr&c��eZdZd�Zy)�ClosedCurTestsc�0�tjd�}|j�}|j�dD]P}|dvrd}n|dk(rdddgf}ng}|j	tj
�5t
||�}||�ddd��Ry#1swY�]xYw)	Nr)r,rlrmrkr�rv)r,rm)zselect 4 union select 5rlzinsert into foo(bar) values (?)r�r!)rrrGrMr`rer7)r.r-r��method_namerx�methods      r�test_closedzClosedCurTests.test_closed�s����n�n�Z�(���j�j�l���	�	��k�K��:�:�5���
�-�;�d�D�\�J�����"�"�6�#:�#:�;� ��k�2�����<�;�l�<�;�s�/B�B	N)r;r<r=rPr@rrrLrL�s�� rrLc�D�eZdZ	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�SqliteOnConflictTestsc��tjd�|_|jj�|_|jjd�y)Nrzz
          CREATE TABLE test(
            id INTEGER PRIMARY KEY, name TEXT, unique_name TEXT UNIQUE
          );
        r+r-s rrJzSqliteOnConflictTests.setUps9���.�.��,����'�'�.�.�"���������	
rc�l�|jj�|jj�yr"r-r-s rrNzSqliteOnConflictTests.tearDownr.rc�b�d|j_|jj�|_|jj	d�|jj	d�|jj	d�|jtj�5|jj	d�ddd�|jj�|jj	d�|j|jj�g�y#1swY�ixYw)N�BEGIN�,INSERT INTO test(name) VALUES ('abort_test')�8INSERT OR ROLLBACK INTO test(unique_name) VALUES ('foo')z"SELECT name, unique_name from test�rr�rGrIr,r`rr_rRr+rkr-s r�3test_on_conflict_rollback_with_explicit_transactionzISqliteOnConflictTests.test_on_conflict_rollback_with_explicit_transactions���"&������'�'�.�.�"��������� ������F�G������R�S�
�
�
�v�4�4�
5��G�G�O�O�V�W�6�	
�����������<�=�������)�)�+�R�0�
6�
5�s�!D%�%D.c�f�d|j_|jj�|_|jj	d�|jj	d�|jj	d�|jtj�5|jj	d�ddd�|jj�|jj	d�|j|jj�ddg�y#1swY�kxYw)NrVrW�5INSERT OR ABORT INTO test(unique_name) VALUES ('foo')�"SELECT name, unique_name FROM test��
abort_testNrerYr-s r�8test_on_conflict_abort_raises_with_explicit_transactionszNSqliteOnConflictTests.test_on_conflict_abort_raises_with_explicit_transactions$s���#'������'�'�.�.�"��������� ������F�G������O�P�
�
�
�v�4�4�
5��G�G�O�O�S�T�6������������<�=�������)�)�+�.B�N�-S�T�6�
5�s�!D'�'D0c��|jjd�|jjd�|jtj�5|jjd�ddd�|jjd�|j|jj
�g�y#1swY�OxYw)NrWrXr]�rIr,r`rr_r+rkr-s r�-test_on_conflict_rollback_without_transactionzCSqliteOnConflictTests.test_on_conflict_rollback_without_transaction4s��������F�G������R�S�
�
�
�v�4�4�
5��G�G�O�O�V�W�6������<�=�������)�)�+�R�0�	6�
5�s�C�C	c��|jjd�|jjd�|jtj�5|jjd�ddd�|jjd�|j|jj
�ddg�y#1swY�QxYw)NrWr\r]r^rerbr-s r�2test_on_conflict_abort_raises_without_transactionszHSqliteOnConflictTests.test_on_conflict_abort_raises_without_transactions>s���	
�����F�G������O�P�
�
�
�v�4�4�
5��G�G�O�O�S�T�6�	
�����<�=�������)�)�+�.B�N�-S�T�	6�
5�s�C�Cc�,�|jjd�|jtj�5|jjd�ddd�|j|jj
�g�y#1swY�4xYw)Nz4INSERT OR FAIL INTO test(unique_name) VALUES ('foo')rbr-s r�test_on_conflict_failz+SqliteOnConflictTests.test_on_conflict_failIsc�������N�O�
�
�
�v�4�4�
5��G�G�O�O�R�S�6�������)�)�+�R�0�6�
5�s�B
�
Bc��|jjd�|jjd�|jjd�|j|jj�dg�y)Nz6INSERT OR IGNORE INTO test(unique_name) VALUES ('foo')zSELECT unique_name FROM testrE�rIr,r+rkr-s r�test_on_conflict_ignorez-SqliteOnConflictTests.test_on_conflict_ignoreOsT�������P�Q������P�Q������6�7�������)�)�+�h�Z�8rc��|jjd�|jjd�|jjd�|j|jj�dg�y)NzFINSERT OR REPLACE INTO test(name, unique_name) VALUES ('Data!', 'foo')zUINSERT OR REPLACE INTO test(name, unique_name) VALUES ('Very different data!', 'foo')r])zVery different data!rFrir-s r�test_on_conflict_replacez.SqliteOnConflictTests.test_on_conflict_replaceVsV�������`�a������o�p������<�=�������)�)�+�.M�-N�OrN)r;r<r=rJrNrZr`rcrergrjrlr@rrrRrRs7���
��
1�U� 1�	U�1�9�PrrRc��eZdZdZd�Zd�Zy)�MultiprocessTestsrc�"�tt�yr")rrr-s rrNzMultiprocessTests.tearDownbs	���v�rc��dt�d|j�d�}tjtj
d|gddtjtj��}|j|j�|jd|jj�j��tjt|j�	�}	|5|jd
�ddd�|j j#d�|j)�|j+|j,�	|jdt.�
�|j|j,d�y#1swY��xYw#tj$$r.}|j j#t'|��Yd}~��d}~wwxYw#|j)�wxYw#tj0$r"|j3�|j��wxYw)Nz�if 1:
            import sqlite3
            def wait():
                print("started")
                assert "database is locked" in input()

            cx = sqlite3.connect("z", timeout=a�)
            cx.create_function("wait", 0, wait)
            with cx:
                cx.execute("create table t(t)")
            try:
                # execute two transactions; both will try to lock the db
                cx.executescript('''
                    -- start a transaction and wait for parent
                    begin transaction;
                    select * from t;
                    select wait();
                    rollback;

                    -- start a new transaction; would fail if parent holds lock
                    begin transaction;
                    select * from t;
                    rollback;
                ''')
            finally:
                cx.close()
        z-czutf-8r)�encoding�bufsize�stdin�stdout�started)�timeoutzinsert into t values('test')zno error�end)�inputrv)r�CONNECTION_TIMEOUT�
subprocess�Popenr�
executable�PIPEr�communicater+rt�readline�striprrr,rsrJr[r�rMr��
returncoder�TimeoutExpired�kill)r.�SCRIPT�procrr/s     r�&test_ctx_mgr_rollback_if_commit_failedz8MultiprocessTests.test_ctx_mgr_rollback_if_commit_failedes���#�$*�(�+�d�6M�6M�5N�O	�
��:���
�^�^�T�6�*����/�/��?�?�
��	
����(�(�)�	
����D�K�K�$8�$8�$:�$@�$@�$B�C�
�^�^�F�D�,C�,C�
D��	���
�
�9�:��

�J�J���Z�(��H�H�J�	
���$�/�/�*�	����5�-��@�
	
������!�,�#����&�&�	'��J�J���S��X�&�&��	'��

�H�H�J���(�(�	��I�I�K������	�sT�E;�E/�,E;�4F?�;G�/E8�4E;�;F<�$F7�2F?�7F<�<F?�?G�5H	N)r;r<r=ryrNr�r@rrrnrn^s�����>-rrn�__main__)7rr�sqlite3rrzrr�r>�urllib.parserr}�test.supportrrrrrr�	_testcapir	r
rrr
�test.support.os_helperrrrrrr�contextmanagerr�r'�TestCaser)rBr�r'rr�r�rr)r�requires_working_threadingr�r�rr&rLrRrnr;�mainr@rr�<module>r�s��.�	���
�������*�)�+�+�Y�Y�"���� �8�8��%��%�hI�(�#�#�hI�V	u6�h�'�'�u6�p-�8�#4�#4�-�(����W�V�.�.��<�1�3�%3�X�&�&�%3�3�%3�PV:��!�!�V:�rw4�(�#�#�w4�t
)��!�!�)�D
-��,�,�.�M6�(�#�#�M6�/�M6�`"�x�(�(�"�,QN�X�&�&�QN�fA�X�&�&�A�F �X�&�&� �&ZP�H�-�-�ZP�z��D-��)�)�D-��D-�N�z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists