U
    |h                     @   s   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mZ e ejd	kd
edddiidG dd deeZdS )    N)skip)
connection)TransactionTestCase)override_settings)Not	PlainText)BackendTests)modelsmysqlz!The current database is not MySQLdefaultZBACKEND,wagtail.search.backends.database.mysql.mysql)ZWAGTAILSEARCH_BACKENDSc                       s   e Zd ZdZdd Zed fddZed fdd	Zed fd
dZed fddZ	ed fddZ
ed fddZ  ZS )TestMySQLSearchBackendr   c                 C   s   ddddddddd	d
ddh}| j ttdtjj }| dd |D | | j td tjj }| dd |D | | j td tjj }| dd |D |ddhB  | j td tjj }| dd |D |dhB  d S )NzA Clash of KingszA Game of ThroneszA Storm of SwordsZ
FoundationzLearning Pythonz
The HobbitzThe Two TowerszThe Fellowship of the RingzThe Return of the KingzThe Rust Programming LanguagezTwo Scoops of Django 1.11zProgramming Rust
javascriptc                 S   s   h | ]
}|j qS  title.0rr   r   o/var/www/dating/data/www/fatepal.com/env/lib/python3.8/site-packages/wagtail/search/tests/test_mysql_backend.py	<setcomp>,   s     z2TestMySQLSearchBackend.test_not.<locals>.<setcomp>c                 S   s   h | ]
}|j qS r   r   r   r   r   r   r   1   s     zjavascript thec                 S   s   h | ]
}|j qS r   r   r   r   r   r   r   9   s     z JavaScript: The Definitive GuidezJavaScript: The good partszjavascript partsc                 S   s   h | ]
}|j qS r   r   r   r   r   r   r   C   s     )	backendsearchr   r   r	   ZBookobjectsallZassertSetEqual)selfZall_other_titlesresultsr   r   r   test_not   sR    
 
 
 
 
zTestMySQLSearchBackend.test_notzThe MySQL backend doesn't support choosing individual fields for the search, only (body, title) or (autocomplete) fields may be searched.c                    s
   t   S N)supertest_search_on_individual_fieldr   	__class__r   r   r    G   s    z6TestMySQLSearchBackend.test_search_on_individual_fieldz+The MySQL backend doesn't support boosting.c                    s
   t   S r   )r   &test_search_boosting_on_related_fieldsr!   r"   r   r   r$   M   s    z=TestMySQLSearchBackend.test_search_boosting_on_related_fieldsc                    s
   t   S r   )r   
test_boostr!   r"   r   r   r%   Q   s    z!TestMySQLSearchBackend.test_boostz,The MySQL backend doesn't score annotations.c                    s
   t   S r   )r   test_annotate_scorer!   r"   r   r   r&   U   s    z*TestMySQLSearchBackend.test_annotate_scorec                    s
   t   S r   )r   test_annotate_score_with_slicer!   r"   r   r   r'   Y   s    z5TestMySQLSearchBackend.test_annotate_score_with_slicez?The MySQL backend doesn't guarantee correct ranking of results.c                    s
   t   S r   )r   test_rankingr!   r"   r   r   r(   ]   s    z#TestMySQLSearchBackend.test_ranking)__name__
__module____qualname__backend_pathr   r   r    r$   r%   r&   r'   r(   __classcell__r   r   r"   r   r      s    	.r   )Zunittestr   Z	django.dbr   Zdjango.test.testcasesr   Zdjango.test.utilsr   Zwagtail.search.queryr   r   Z"wagtail.search.tests.test_backendsr   Zwagtail.test.searchr	   Z
skipUnlessvendorr   r   r   r   r   <module>   s     