o
    -˜Žj‹M  ã                   @   sŒ   d dl 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 dlm	Z	 d dl
mZmZ d dlmZ d dlZdd	lmZ G d
d„ deƒZdS )é    N)ÚPath)ÚOperationalError)ÚTemporaryDirectory©ÚThread)ÚIsolatedAsyncioTestCaseÚSkipTest)Úpatché   ©Úsetup_loggerc                   @   s  e Zd Zedd„ ƒZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd3d4„ Zd5d6„ Zd7d8„ Zd9d:„ Z d;d<„ Z!d=d>„ Z"d?d@„ Z#dAS )BÚ	SmokeTestc                 C   s
   t ƒ  d S ©Nr   )Úcls© r   úR/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/aiosqlite/tests/smoke.pyÚ
setUpClass   s   
zSmokeTest.setUpClassc                 C   s*   t ƒ }|  |j¡ t|jƒ ¡ d | _d S )Nztest.db)r   Ú
addCleanupÚcleanupr   ÚnameÚresolveÚdb)ÚselfÚtdr   r   r   ÚsetUp   s   zSmokeTest.setUpc              	   Ã   sŽ   �t  | j¡I d H }|  |t j¡ | d¡4 I d H š}| ¡ I d H }|  |dg¡ W d   ƒI d H  n1 I d H s9w   Y  | ¡ I d H  d S ©Núselect 1, 2)r
   é   )	Ú	aiosqliteÚconnectr   ÚassertIsInstanceÚ
ConnectionÚexecuteÚfetchallÚassertEqualÚclose©r   r   ÚcursorÚrowsr   r   r   Útest_connection_await   s   €(þzSmokeTest.test_connection_awaitc              
   Ã   s°   �t  | j¡4 I d H š@}|  |t j¡ | d¡4 I d H š}| ¡ I d H }|  |dg¡ W d   ƒI d H  n1 I d H s;w   Y  W d   ƒI d H  d S 1 I d H sQw   Y  d S r   )r   r   r   r    r!   r"   r#   r$   r&   r   r   r   Útest_connection_context&   s   €*þ.ýz!SmokeTest.test_connection_contextc              
   ƒ   s4  �| j  ¡ ‰ G ‡ fdd„dƒ}tˆ ƒˆ ˆ  ¡ |ƒ f}t |d ¡4 I d H š1}| d¡I d H  | d¡I d H  | ¡ I d H  | d¡I d H }| ¡ I d H }W d   ƒI d H  n1 I d H s\w   Y  |D ]4}t |¡4 I d H š}| d¡I d H }|  	| ¡ I d H |¡ W d   ƒI d H  n1 I d H s’w   Y  qcd S )Nc                       s   e Zd Z‡ fdd„ZdS )z1SmokeTest.test_connection_locations.<locals>.Fakec                    s   ˆ S r   r   ©r   ©ÚTEST_DBr   r   Ú__str__2   ó   z9SmokeTest.test_connection_locations.<locals>.Fake.__str__N)Ú__name__Ú
__module__Ú__qualname__r.   r   r,   r   r   ÚFake1   s    r3   r   z'create table foo (i integer, k integer)z$insert into foo (i, k) values (1, 5)úselect * from foo)
r   Úas_posixr   Úencoder   r   r"   Úcommitr#   r$   )r   r3   Úlocsr   r'   r(   Úlocr   r,   r   Útest_connection_locations.   s$   €
(ú(þ€ÿz#SmokeTest.test_connection_locationsc              	   ƒ   sò   �t  ˆj¡4 I d H š}| d¡I d H  W d   ƒI d H  n1 I d H s$w   Y  ‡fdd„‰ tj‡ fdd„tdƒD ƒŽ I d H  t  ˆj¡4 I d H š}| d¡I d H }| ¡ I d H }W d   ƒI d H  n1 I d H sjw   Y  t|ƒdkswJ ‚d S )NzHcreate table multiple_connections (i integer primary key asc, k integer)c              	   “   sj   �t  ˆ j¡4 I d H š}| d| g¡I d H  | ¡ I d H  W d   ƒI d H  d S 1 I d H s.w   Y  d S )Nz/insert into multiple_connections (k) values (?))r   r   r   r"   r7   )Úir   r+   r   r   Údo_one_connK   s
   €.þz8SmokeTest.test_multiple_connections.<locals>.do_one_connc                    s   g | ]}ˆ |ƒ‘qS r   r   ©Ú.0r;   )r<   r   r   Ú
<listcomp>P   s    z7SmokeTest.test_multiple_connections.<locals>.<listcomp>é
   z"select * from multiple_connections)	r   r   r   r"   ÚasyncioÚgatherÚranger#   Úlenr&   r   )r<   r   r   Útest_multiple_connectionsD   s   €ÿ(ÿ"(þz#SmokeTest.test_multiple_connectionsc              	   ƒ   sô   �t  | j¡4 I d H š+‰ ˆ  d¡I d H  tj‡ fdd„tdƒD ƒŽ I d H  ˆ  ¡ I d H  W d   ƒI d H  n1 I d H s<w   Y  t  | j¡4 I d H š‰ ˆ  d¡I d H }| ¡ I d H }W d   ƒI d H  n1 I d H skw   Y  t	|ƒdksxJ ‚d S )NzDcreate table multiple_queries (i integer primary key asc, k integer)c                    s   g | ]	}ˆ   d |g¡‘qS )z+insert into multiple_queries (k) values (?))r"   r=   ©r   r   r   r?   `   s    ÿÿz3SmokeTest.test_multiple_queries.<locals>.<listcomp>r@   zselect * from multiple_queries)
r   r   r   r"   rA   rB   rC   r7   r#   rD   )r   r'   r(   r   rF   r   Útest_multiple_queriesX   s"   €
ÿ
þ
ÿ(ó(þzSmokeTest.test_multiple_queriesc              	   Ã   s  �t  | j¡4 I d H š1}| ¡ I d H }| d¡I d H  | ddd„ tdƒD ƒ¡I d H  | ¡ I d H  W d   ƒI d H  n1 I d H sBw   Y  t  | j¡4 I d H š$}| d¡I d H }g }|2 z3 d H W }| |¡ q^6 W d   ƒI d H  n1 I d H s{w   Y  t	|ƒdksˆJ ‚d S )NzCcreate table iterable_cursor (i integer primary key asc, k integer)z*insert into iterable_cursor (k) values (?)c                 S   ó   g | ]}|g‘qS r   r   r=   r   r   r   r?   u   ó    z2SmokeTest.test_iterable_cursor.<locals>.<listcomp>r@   zselect * from iterable_cursor©
r   r   r   r'   r"   ÚexecutemanyrC   r7   ÚappendrD   ©r   r   r'   r(   Úrowr   r   r   Útest_iterable_cursorn   s&   €
ÿ
ÿ(ø
ÿ(ýzSmokeTest.test_iterable_cursorc              	   ƒ   sð   �i ‰‡‡fdd„‰t  d¡4 I d H šA‰ ˆ  d¡I d H  ˆ  dd¡I d H  ˆ  ¡ I d H  ‡ ‡fdd„td	ƒD ƒ}|D ]}| ¡  q:|D ]}| ¡  qCW d   ƒI d H  n1 I d H sZw   Y  ˆ tˆƒd	¡ ˆ 	¡ D ]
}ˆ t|ƒd
¡ qkd S )Nc                    sb   ‡ ‡fdd„}ˆ  | ¡� t ¡ }| |ƒ ¡}| ¡  |ˆ| < W d   ƒ d S 1 s*w   Y  d S )Nc               	   “   sf   �ˆ   d¡4 I d H š} |  ¡ I d H }ˆ t|ƒd¡ |W  d   ƒI d H  S 1 I d H s,w   Y  d S )Nr4   r   )r"   r#   r$   rD   )r'   r(   )Úconnr   r   r   Úquery…   s   €0ýz>SmokeTest.test_multi_loop_usage.<locals>.runner.<locals>.query)ÚsubTestrA   Únew_event_loopÚrun_until_completer%   )ÚkrP   rQ   Úloopr(   )Úresultsr   )rP   r   Úrunner„   s   
"üz/SmokeTest.test_multi_loop_usage.<locals>.runnerú:memory:z'create table foo (id int, name varchar)z%insert into foo values (?, ?), (?, ?))r
   ÚSallyr   ÚJanetc                    s   g | ]
}t ˆ|ˆ fd �‘qS ))ÚtargetÚargsr   )r>   rU   )r   rX   r   r   r?   ˜   s    z3SmokeTest.test_multi_loop_usage.<locals>.<listcomp>é   r   )
r   r   r"   r7   rC   ÚstartÚjoinr$   rD   Úvalues)r   ÚthreadsÚthreadr(   r   )r   rW   rX   r   r   Útest_multi_loop_usage�   s(   €
ÿ

ÿ(öÿzSmokeTest.test_multi_loop_usagec              
   Ã   sp  �t  | j¡4 I d H šH}| ¡ 4 I d H š*}| d¡I d H  | ddd„ tdƒD ƒ¡I d H  | ¡ I d H  W d   ƒI d H  n1 I d H sDw   Y  W d   ƒI d H  n1 I d H sYw   Y  t  | j¡4 I d H š;}| d¡4 I d H š}g }|2 z3 d H W }| |¡ qw6 W d   ƒI d H  n1 I d H s”w   Y  W d   ƒI d H  n1 I d H s©w   Y  t	|ƒdks¶J ‚d S )NzBcreate table context_cursor (i integer primary key asc, k integer)z)insert into context_cursor (k) values (?)c                 S   rH   r   r   r=   r   r   r   r?   «   rI   z1SmokeTest.test_context_cursor.<locals>.<listcomp>r@   zselect * from context_cursorrJ   rM   r   r   r   Útest_context_cursor¢   s,   €
ÿ
þ*÷(ÿÿ*þ(ÿzSmokeTest.test_context_cursorc              	   Ã   s²   �t  | j¡4 I d H šA}| ¡ I d H }| d¡I d H }|  ||d¡ | dddg¡I d H }|  ||¡ | d¡I d H }|  ||¡ W d   ƒI d H  d S 1 I d H sRw   Y  d S )Nz;create table test_cursor_return_self (i integer, k integer)zcursor execute returns itselfz1insert into test_cursor_return_self values (?, ?))r
   r
   )r   r   z–insert into test_cursor_return_self values (3, 3);insert into test_cursor_return_self values (4, 4);insert into test_cursor_return_self values (5, 5);)r   r   r   r'   r"   r$   rK   Úexecutescript)r   r   r'   Úresultr   r   r   Útest_cursor_return_self·   s    €
ÿ
ÿ
ÿ.îz!SmokeTest.test_cursor_return_selfc              
   Ã   sL  �t  | j¡4 I d H �šŒ}|  |jd¡ | ¡ 4 I d H š4}|  |j¡ | d¡I d H  | d¡I d H  |  	|j¡ | 
¡ I d H  |  |j¡ W d   ƒI d H  n1 I d H sVw   Y  |  |jd¡ |  |j¡ |  |jt¡ | ¡ 4 I d H š?}| d¡I d H  | ¡ I d H }|  |t¡ |  |d¡ |  t¡� |d }W d   ƒ n1 s§w   Y  W d   ƒI d H  n1 I d H s¼w   Y  | ¡ 4 I d H šM}t j|_|  |jt j¡ | d¡I d H  | ¡ I d H }|  |t j¡ |  |d d¡ |  |d d	¡ |  |d d¡ |  |d
 d	¡ W d   ƒI d H  n1 I d H �sw   Y  t j|_t|_|  |jt j¡ |  |jt¡ | ¡ 4 I d H šA}| d¡I d H  | ¡ I d H }|  |t j¡ |  |d d¡ |  |d d¡ |  |d d¡ |  |d
 d¡ W d   ƒI d H  n1 I d H �sˆw   Y  W d   ƒI d H  d S 1 I d H �sŸw   Y  d S )Nr   zKcreate table test_properties (i integer primary key asc, k integer, d text)z3insert into test_properties (k, d) values (1, 'hi')r
   zselect * from test_properties)r
   r
   ÚhirU   r   ri   Úds   hi)r   r   r   r$   Útotal_changesr'   ÚassertFalseÚin_transactionr"   Ú
assertTruer7   ÚassertIsNoneÚrow_factoryÚtext_factoryÚstrÚfetchoner    ÚtupleÚassertRaisesÚ	TypeErrorÚRowÚbytes)r   r   r'   rN   Ú_r   r   r   Útest_connection_propertiesÌ   sh   €
ÿ
ÿ(õ
ÿ(û*÷,ù0Óz$SmokeTest.test_connection_propertiesc              	   Ã   sä   �t  | j¡4 I d H š"}| d¡I d H  | d¡I d H  | ¡ I d H  W d   ƒI d H  n1 I d H s3w   Y  t  | j¡4 I d H š#}| d¡I d H }| ¡ I d H }|  |g d¢¡ W d   ƒI d H  d S 1 I d H skw   Y  d S )NzBcreate table test_fetch_all (i integer primary key asc, k integer)z<insert into test_fetch_all (k) values (10), (24), (16), (32)z)select k from test_fetch_all where k < 30))r@   )é   )é   )r   r   r   r"   r7   r#   r$   r&   r   r   r   Útest_fetch_all  s   €
ÿ
ÿ(ù	.ýzSmokeTest.test_fetch_allc                 Ã   sÖ   �t  | j¡4 I dH šS}z| d¡I dH  | d¡I dH  W n) ty7 } zd|jvs-J ‚W Y d}~n d}~w tyG } ztdƒ|‚d}~ww W d  ƒI dH  dS W d  ƒI dH  dS 1 I dH sdw   Y  dS )z@Assert that after enabling extension loading, they can be loadedNTÚtestznot authorizedzKpython was not compiled with sqlite3 extension support, so we can't test it)	r   r   r   Úenable_load_extensionÚload_extensionr   r]   ÚAttributeErrorr   )r   r   Úer   r   r   Útest_enable_load_extension  s(   €€ÿý€ÿýý.ûz$SmokeTest.test_enable_load_extensionc              	   Ã   s˜   �t  | j¡4 I dH š4}| dd„ d¡I dH  |  t¡� | d¡I dH  W d  ƒ n1 s/w   Y  W d  ƒI dH  dS 1 I dH sEw   Y  dS )ze
        Assert that after setting a progress handler returning 1, DB operations are aborted
        Nc                   S   ó   dS )Nr
   r   r   r   r   r   Ú<lambda>%  s    z5SmokeTest.test_set_progress_handler.<locals>.<lambda>r
   zIcreate table test_progress_handler (i integer primary key asc, k integer))r   r   r   Úset_progress_handlerru   r   r"   ©r   r   r   r   r   Útest_set_progress_handler   s   €ÿÿ.þz#SmokeTest.test_set_progress_handlerc              
   Ã   s8  �dd„ }dd„ }t  | j¡4 I dH š|}| dd|¡I dH  | dd	|¡I dH  | d
¡4 I dH š}| ¡ I dH }|  |d d¡ W d  ƒI dH  n1 I dH sQw   Y  | d¡4 I dH š}| ¡ I dH }|  |d d¡ W d  ƒI dH  n1 I dH sw   Y  W d  ƒI dH  dS 1 I dH s•w   Y  dS )z<Assert that after creating a custom function, it can be usedc                   S   r„   )Núno argr   r   r   r   r   Úno_arg.  r/   z.SmokeTest.test_create_function.<locals>.no_argc                 S   ó   | d S ©Nr   r   ©Únumr   r   r   Úone_arg1  ó   z/SmokeTest.test_create_function.<locals>.one_argNrŠ   r   r�   r
   zSELECT no_arg();r‰   zSELECT one_arg(10);é   )r   r   r   Úcreate_functionr"   rs   r$   )r   rŠ   r�   r   ÚresrN   r   r   r   Útest_create_function+  s   €(þ*þ.øzSmokeTest.test_create_functionc              	   Ã   sˆ   �dd„ }t  | j¡4 I dH š(}|jdd|dd�I dH  | d¡I dH  | d	¡I dH  W d  ƒI dH  dS 1 I dH s=w   Y  dS )
zƒAssert that after creating a deterministic custom function, it can be used.

        https://sqlite.org/deterministic.html
        c                 S   r‹   rŒ   r   r�   r   r   r   r�   F  r�   z=SmokeTest.test_create_function_deterministic.<locals>.one_argNr�   r
   T)Údeterministicz"create table foo (id int, bar int)z#create index t on foo(one_arg(bar)))r   r   r   r’   r"   )r   r�   r   r   r   r   Ú"test_create_function_deterministic@  s   €.ûz,SmokeTest.test_create_function_deterministicc              	   ƒ   sŠ   �g ‰ dt f‡ fdd„}t | j¡4 I d H š"}| |¡I d H  | d¡I d H  |  dˆ ¡ W d   ƒI d H  d S 1 I d H s>w   Y  d S )NÚ	statementc                    s   ˆ   | ¡ d S r   )rL   )r—   ©Ú
statementsr   r   ÚcallbackS  s   z3SmokeTest.test_set_trace_callback.<locals>.callbackz	select 10)rr   r   r   r   Úset_trace_callbackr"   ÚassertIn)r   rš   r   r   r˜   r   Útest_set_trace_callbackP  s   €.üz!SmokeTest.test_set_trace_callbackc              	   Ã   s  �dd„ }t  | j¡4 I dH šj}| |¡I dH  | d¡I dH  | d¡I dH  | d¡I dH  |  tj¡� | d¡I dH  W d  ƒ n1 sIw   Y  tj	dkrn| d¡I dH  | d¡I dH  W d  ƒI dH  dS W d  ƒI dH  dS 1 I dH sw   Y  dS )	z+Test authorizer that denies DROP operationsc                 S   s   | t jkrt jS t jS r   )Úsqlite3ÚSQLITE_DROP_TABLEÚSQLITE_DENYÚ	SQLITE_OK©Úaction_codeÚarg1Úarg2Údb_nameÚtrigger_namer   r   r   Ú
deny_drops_  s   
z<SmokeTest.test_set_authorizer_deny_drops.<locals>.deny_dropsNz#CREATE TABLE test_drop (id INTEGER)z INSERT INTO test_drop VALUES (1)zSELECT * FROM test_dropzDROP TABLE test_drop)é   é   )
r   r   r   Úset_authorizerr"   ru   rž   ÚDatabaseErrorÚsysÚversion_info)r   r¨   r   r   r   r   Útest_set_authorizer_deny_drops\  s    €ÿ
ñ.ôz(SmokeTest.test_set_authorizer_deny_dropsc              	   Ã   sœ   �dd„ }t  | j¡4 I dH š2}| |¡I dH  |  tj¡� | d¡I dH  W d  ƒ n1 s1w   Y  W d  ƒI dH  dS 1 I dH sGw   Y  dS )zGTest that exceptions raised in authorizer callback are caught by SQLitec                 S   s   t dƒ‚)NzTest exception from authorizer)Ú
ValueErrorr¢   r   r   r   Úraise_exceptionx  r�   zLSmokeTest.test_set_authorizer_exception_propagation.<locals>.raise_exceptionNz(CREATE TABLE test_exception (id INTEGER))r   r   r   r«   ru   rž   r¬   r"   )r   r±   r   r   r   r   Ú)test_set_authorizer_exception_propagationu  s   €ÿ.þz3SmokeTest.test_set_authorizer_exception_propagationc              
   Ã   sÀ   �t dƒ}|  td¡�, t |¡4 I d H š}|  |¡ W d   ƒI d H  n1 I d H s+w   Y  W d   ƒ n1 s:w   Y  |  td¡� t |¡I d H  W d   ƒ d S 1 sYw   Y  d S )Nz!/something/that/shouldnt/exist.dbzunable to open database)r   ÚassertRaisesRegexr   r   r   ro   )r   Úbad_dbr   r   r   r   Útest_connect_error€  s   €(ÿ€ÿ"ÿzSmokeTest.test_connect_errorc                 Ã   sÊ   �dd„ }t  dd„ d¡}tjtd|d��; |  tjd¡�$ |4 I d H š W d   ƒI d H  n1 I d H s5w   Y  W d   ƒ n1 sDw   Y  W d   ƒ n1 sSw   Y  |jrc| 	¡  t
d	ƒ‚d S )
Nc                  _   s
   t  d¡‚)NúI changed my mind)rA   ÚCancelledError)ry   Ú__r   r   r   Ú_raise_cancelled_error‹  s   
zESmokeTest.test_connect_base_exception.<locals>._raise_cancelled_errorc                   S   s
   t  d¡S ©NrY   )rž   r   r   r   r   r   r…   Ž  s   
 z7SmokeTest.test_connect_base_exception.<locals>.<lambda>é@   r   )Úside_effectr¶   z!connection thread was not stopped)r   r!   r	   Úobjectrž   r³   rA   r·   Ú_runningÚstopÚAssertionError)r   r¹   Ú
connectionr   r   r   Útest_connect_base_exception‰  s$   €ÿþ(ÿ€ü€ þz%SmokeTest.test_connect_base_exceptionc              	   Ã   s”   �t  d¡4 I d H š3}| d¡I d H  | dddg¡I d H  dd„ | ¡ 2 ƒI d H }|  |g d¢¡ W d   ƒI d H  d S 1 I d H sCw   Y  d S )	NrY   ú,create table foo (i integer, k charvar(250))úinsert into foo values (?, ?)©r
   Úhello©r   Úworldc                 Ó   s   �g | z3 d H W }|‘q6 S r   r   )r>   Úliner   r   r   r?   ¡  s   € z+SmokeTest.test_iterdump.<locals>.<listcomp>)zBEGIN TRANSACTION;z-CREATE TABLE foo (i integer, k charvar(250));z$INSERT INTO "foo" VALUES(1,'hello');z$INSERT INTO "foo" VALUES(2,'world');zCOMMIT;)r   r   r"   rK   Úiterdumpr$   )r   r   Úlinesr   r   r   Útest_iterdumpš  s   €
ÿþ.ùzSmokeTest.test_iterdumpc                 Ã   s¬   �t  | j¡I d H }| d¡I d H }| ¡ I d H  |  td¡� | ¡ I d H  W d   ƒ n1 s1w   Y  |  td¡� | ¡ I d H  W d   ƒ d S 1 sOw   Y  d S )Nr   zConnection closed)r   r   r   r"   r%   r³   r°   r#   )r   r   r'   r   r   r   Ú test_cursor_on_closed_connection­  s   €ÿ"ÿz*SmokeTest.test_cursor_on_closed_connectionc              	   Ã   s–   �t  | j¡I d H }| d¡I d H }g }tdƒD ]}|dkr(| t | ¡ ¡¡ | t | 	¡ ¡¡ q|D ]}z|I d H  W q5 t
jyH   Y q5w d S )Nr   éd   é2   )r   r   r   r"   rC   rL   rA   Úensure_futurer%   r#   rž   ÚProgrammingError)r   r   r'   Útasksr;   Útaskr   r   r   Ú%test_cursor_on_closed_connection_loop·  s   €ÿýz/SmokeTest.test_cursor_on_closed_connection_loopc                 Ã   s\   �t  | j¡I d H }tdƒD ]}| d|› �¡I d H  q| ¡ I d H  |  |j ¡ d¡ d S )Niè  z
select 1, T)	r   r   r   rC   r"   r%   r$   Ú_txÚempty)r   r   r;   r   r   r   Ú1test_close_blocking_until_transaction_queue_emptyÆ  s   €z;SmokeTest.test_close_blocking_until_transaction_queue_emptyc                 Ã   s4   �t  | j¡I d H }| ¡ I d H  | ¡ I d H  d S r   )r   r   r   r%   r‡   r   r   r   Útest_close_twiceÑ  s   €zSmokeTest.test_close_twicec                 Ã   sl  �dd„ }t  d¡4 I d H š›}t  d¡4 I d H š{}| d¡I d H  | dddg¡I d H  | ¡ I d H  |  td¡� | d	¡I d H  W d   ƒ n1 sLw   Y  |j||d
�I d H  | d	¡4 I d H š}| ¡ I d H }|  	|ddg¡ W d   ƒI d H  n1 I d H s„w   Y  W d   ƒI d H  n1 I d H s™w   Y  W d   ƒI d H  d S 1 I d H s¯w   Y  d S )Nc                 S   s   t | ||ƒ d S r   )Úprint)ÚaÚbÚcr   r   r   ÚprogressÚ  s   z1SmokeTest.test_backup_aiosqlite.<locals>.progressrY   rÃ   rÄ   rÅ   rÇ   úno such table: foor4   )rÝ   )
r   r   r"   rK   r7   r³   r   Úbackupr#   r$   )r   rÝ   Údb1Údb2r'   r(   r   r   r   Útest_backup_aiosqliteÙ  s,   €
ÿ
þ
ÿÿ*þXñzSmokeTest.test_backup_aiosqlitec              
   Ã   s  �t  d¡4 I d H šo}t d¡�V}| d¡I d H  | dddg¡I d H  | ¡ I d H  |  td¡� | d¡ W d   ƒ n1 sAw   Y  | |¡I d H  | d¡}| 	¡ }|  
|ddg¡ W d   ƒ n1 siw   Y  W d   ƒI d H  d S 1 I d H sw   Y  d S )NrY   rÃ   rÄ   rÅ   rÇ   rÞ   r4   )r   r   rž   r"   rK   r7   r³   r   rß   r#   r$   )r   rà   rá   r'   r(   r   r   r   Útest_backup_sqliteð  s"   €
ÿÿ
ò.ÿzSmokeTest.test_backup_sqlitec                 Ã   sF   �t  d¡I d H }|  td¡�
 ~W d   ƒ d S 1 sw   Y  d S )NrY   z#.*was deleted before being closed.*)r   r   ÚassertWarnsRegexÚResourceWarningr‡   r   r   r   Ú!test_emits_warning_when_left_open  s   €ÿ"ýz+SmokeTest.test_emits_warning_when_left_openc                 Ã   s$   �t  d¡I d H }| ¡ I d H  d S rº   )r   r   r¿   r‡   r   r   r   Útest_stop_without_close
  s   €z!SmokeTest.test_stop_without_closec                    s8   d ‰ ‡ fdd„}t  ¡ }| |ƒ ¡ | ¡  ˆ  ¡  d S )Nc                   “   s   �t  d¡I d H ‰ d S rº   )r   r   r   rF   r   r   Úinner  s   €z:SmokeTest.test_stop_after_event_loop_closed.<locals>.inner)rA   rS   rT   r%   r¿   )r   rè   rV   r   rF   r   Ú!test_stop_after_event_loop_closed  s   z+SmokeTest.test_stop_after_event_loop_closedN)$r0   r1   r2   Úclassmethodr   r   r)   r*   r:   rE   rG   rO   rd   re   rh   rz   r}   rƒ   rˆ   r”   r–   r�   r¯   r²   rµ   rÂ   rÌ   rÍ   rÔ   r×   rØ   râ   rã   ræ   rç   ré   r   r   r   r   r      sD    

!7	
r   )rA   rž   r­   Úpathlibr   r   Útempfiler   Ú	threadingr   Úunittestr   r   Úunittest.mockr	   r   Úhelpersr   r   r   r   r   r   Ú<module>   s   