File: //usr/local/lib/python3.7/sqlite3/test/__pycache__/hooks.cpython-37.pyc
B
��g2) � @ sx d dl Z d dlZd dlmZmZ G dd� de j�ZG dd� de j�ZG dd� de j�Z d d
� Z
dd� Zed
krte� dS )� N)�TESTFN�unlinkc @ s^ e Zd Zdd� Zdd� Zdd� Zdd� Ze�e j
d k d
�dd� �Zd
d� Zdd� Z
dd� ZdS )�CollationTestsc C s4 t �d�}| �t�� |�d dd� � W d Q R X d S )Nz:memory:c S s | |k| |k S )N� )�x�yr r �./usr/local/lib/python3.7/sqlite3/test/hooks.py�<lambda>! � z>CollationTests.CheckCreateCollationNotString.<locals>.<lambda>)�sqlite�connect�assertRaises� TypeError�create_collation)�self�conr r r �CheckCreateCollationNotString s
z,CollationTests.CheckCreateCollationNotStringc C sB t �d�}| �t��}|�dd� W d Q R X | �t|j�d� d S )Nz:memory:�X�* zparameter must be callable)r r r
r r �assertEqual�str� exception)r r �cmr r r �CheckCreateCollationNotCallable# s
z.CollationTests.CheckCreateCollationNotCallablec C s6 t �d�}| �t j�� |�ddd� � W d Q R X d S )Nz:memory:u colläc S s | |k| |k S )Nr )r r r r r r , r
z=CollationTests.CheckCreateCollationNotAscii.<locals>.<lambda>)r r r
ZProgrammingErrorr )r r r r r �CheckCreateCollationNotAscii) s
z+CollationTests.CheckCreateCollationNotAsciic C sl G dd� dt �}t�d�}dd� }|�|d�|� |�d��� }| �|d d d � | �|d
d d� d S )Nc @ s e Zd Zdd� ZdS )z@CollationTests.CheckCreateCollationBadUpper.<locals>.BadUpperStrc S s d S )Nr )r r r r �upper0 s zFCollationTests.CheckCreateCollationBadUpper.<locals>.BadUpperStr.upperN)�__name__�
__module__�__qualname__r r r r r �BadUpperStr/ s r z:memory:c S s | |k| |k S )Nr )r r r r r r 3 r
z=CollationTests.CheckCreateCollationBadUpper.<locals>.<lambda>�mycollz�
select x from (
select 'a' as x
union
select 'b' as x
) order by x collate mycoll
r �b� �a)r r r r �execute�fetchallr )r r r r �resultr r r �CheckCreateCollationBadUpper. s
z+CollationTests.CheckCreateCollationBadUpper)� � r"