Your IP : 216.73.216.52


Current Path : /opt/alt/python310/lib64/python3.10/sqlite3/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/sqlite3/test/__pycache__/transactions.cpython-310.opt-1.pyc

o

0�i7�@s�ddlZddlZddlZddlmZddlmZmZedZ	Gdd�dej
�ZGdd�dej
�ZGd	d
�d
ej
�Z
dd�Zd
d�ZedkrJe�dSdS)�N)�LOOPBACK_TIMEOUT)�TESTFN�unlink�
c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�TransactionTestscCs<tjttd�|_|j��|_tjttd�|_|j��|_dS)N)Ztimeout)	�sqlite�connectr�TIMEOUT�con1�cursor�cur1�con2�cur2��self�r�@/opt/alt/python310/lib64/python3.10/sqlite3/test/transactions.py�setUp"szTransactionTests.setUpcCsBz|j��|j��|j��|j��Wtt�dStt�w�N)r�closer
rr
rrrrrr�tearDown)s


zTransactionTests.tearDowncCsN|j�d�|j�d�|j�d�|j�d�|j��}|�t|�d�dS)N�create table test(i)�insert into test(i) values (5)zcreate table test2(j)�select i from testr�r�executer�fetchall�assertEqual�len�r�resrrr�$test_dml_does_not_auto_commit_before4s
z5TransactionTests.test_dml_does_not_auto_commit_beforecCsB|j�d�|j�d�|j�d�|j��}|�t|�d�dS)Nrrrrrrrrr�test_insert_starts_transaction<s

z/TransactionTests.test_insert_starts_transactioncCsX|j�d�|j�d�|j��|j�d�|j�d�|j��d}|�|d�dS)Nrrzupdate test set i=6rr�)rrr
�commitrZfetchonerrrrr�test_update_starts_transactionCs
z/TransactionTests.test_update_starts_transactioncCsX|j�d�|j�d�|j��|j�d�|j�d�|j��}|�t|�d�dS)Nrrzdelete from testr��rrr
r$rrrrrrrr�test_delete_starts_transactionLs

z/TransactionTests.test_delete_starts_transactioncCsl|j�d�|j�d�|j��|j�d�|j�d�|j��}|�t|�d�|�|ddd�dS)Nrrzreplace into test(i) values (6)rr&rr#r'rrrr�test_replace_starts_transactionUs

z0TransactionTests.test_replace_starts_transactioncCs�|j�d�|j�d�d|j_|�|jjd�|j�d�|j��}|�t|�d�d|j_|�|jjd�|j�d�|j�d�|j��}|�t|�d�dS)Nrrrr&ZDEFERRED)rrr
Zisolation_levelrrrrrrrr�test_toggle_auto_commit_s

z(TransactionTests.test_toggle_auto_commitcCsV|j�d�|j�d�|�tj��|j�d�Wd�dS1s$wYdS)Nrr)rr�assertRaisesr�OperationalErrorrrrrr�test_raise_timeoutos
"�z#TransactionTests.test_raise_timeoutcCs^|j�d�|j�d�|�tj��|j�d�Wd�n1s#wY|j��dS)z�
        This tests the improved concurrency with pysqlite 2.3.4. You needed
        to roll back con2 before you could commit con1.
        rrN)rrr+rr,rr
r$rrrr�test_lockingus�zTransactionTests.test_lockingcCsrt�d�}|��}|�d�|�d�|�d�|��|�tj��
|��Wd�dS1s2wYdS)z�
        Checks if cursors on the connection are set into a "reset" state
        when a rollback is done on the connection.
        �:memory:zcreate table test(x)zinsert into test(x) values (5)z&select 1 union select 2 union select 3N)rrrr�rollbackr+ZInterfaceErrorr)r�con�currrr� test_rollback_cursor_consistency�s




"�z1TransactionTests.test_rollback_cursor_consistencyN)�__name__�
__module__�__qualname__rrr!r"r%r(r)r*r-r.r3rrrrr!s		
rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�SpecialCommandTestscCst�d�|_|j��|_dS�Nr/)rrr1rr2rrrrr�szSpecialCommandTests.setUpcC�(|j�d�|j�d�|j�d�dS)Nrrzdrop table test�r2rrrrr�test_drop_table��z#SpecialCommandTests.test_drop_tablecCr9)Nrrzpragma count_changes=1r:rrrr�test_pragma�r<zSpecialCommandTests.test_pragmacCs|j��|j��dSr)r2rr1rrrrr�s
zSpecialCommandTests.tearDownN)r4r5r6rr;r=rrrrrr7�s
r7c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TransactionalDDLcCst�d�|_dSr8)rrr1rrrrr�szTransactionalDDL.setUpcCs6|j�d�|j��|j�d���}|�|g�dS)Nr�select * from test)r1rr0rr)r�resultrrr�'test_ddl_does_not_autostart_transaction�s
z8TransactionalDDL.test_ddl_does_not_autostart_transactioncC�`|j�d�|j�d�|j��|�tj��|j�d�Wd�dS1s)wYdS)Nzbegin immediaterr?�r1rr0r+rr,rrrr� test_immediate_transactional_ddl��
"�z1TransactionalDDL.test_immediate_transactional_ddlcCrB)NZbeginrr?rCrrrr�test_transactional_ddl�rEz'TransactionalDDL.test_transactional_ddlcCs|j��dSr)r1rrrrrr�szTransactionalDDL.tearDownN)r4r5r6rrArDrFrrrrrr>�s		r>cCstttg}t�dd�|D��S)NcSsg|]	}t���|��qSr)�unittestZ
TestLoaderZloadTestsFromTestCase)�.0�trrr�
<listcomp>�szsuite.<locals>.<listcomp>)r7rr>rGZ	TestSuite)Ztestsrrr�suite�s��rKcCst��}|�t��dSr)rGZTextTestRunner�runrK)Zrunnerrrr�test�srM�__main__)�osrGZsqlite3rZtest.supportrZtest.support.os_helperrrr	ZTestCaserr7r>rKrMr4rrrr�<module>so!

�