Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_webbrowser.cpython-312.opt-1.pyc

�

'Μg�)���ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ejsejd��dZ
dZGd	�d
ej�ZGd�d�ZGd
�deej$�ZGd�deej$�ZGd�deej$�ZGd�deej$�ZGd�deej$�ZGd�deej$�ZGd�deej$�ZGd�deej$�ZGd�dej$�ZGd�d ej$�Zed!k(rej<�yy)"�N)�mock)�support)�
import_helper)�	os_helperz"test webserver requires subprocesszhttps://www.example.com�testc��eZdZd�Zdd�Zy)�	PopenMockc��y�Nr���selfs �1/usr/local/lib/python3.12/test/test_webbrowser.py�pollzPopenMock.poll����Nc��yrr)r�secondss  r�waitzPopenMock.waitrr�N)�__name__�
__module__�__qualname__rrrrrr	r	s���rr	c��eZdZegid�d�Zy)�CommandTestMixin)�args�kwc���t�}tj|td|�|j	t
��}t
||�|i|��tjjdd}|j|dt
�|jd�|D]4}	|j|	|�|j|j|	���6|j||�y)ajGiven a web browser instance method name along with arguments and
        keywords for same (which defaults to the single argument URL), creates
        a browser instance from the class pointed to by self.browser, calls the
        indicated instance method with the indicated arguments, and compares
        the resulting options and arguments passed to Popen by the browser
        instance against the 'options' and 'args' lists.  Options are compared
        in a position independent fashion, and the arguments are compared in
        sequence order to whatever is left over after removing the options.

        �Popen)�namerN)
r	r�patch�
subprocess�
browser_class�CMD_NAME�getattrr�	call_args�assertEqual�pop�assertIn�index)
r�methrr�options�	arguments�popen�browser�
popen_args�options
          r�_testzCommandTestMixin._tests�������
�
�d�J���7��$�$�(�$�3��������+��+��%�%�/�/��2�1�5�
�����A���1����q���F��M�M�&�*�-��N�N�:�+�+�F�3�4��	
����Y�/rN)rrr�URLr2rrrrrs��#&�%�B�0rrc�*�eZdZejZd�Zy)�GenericBrowserCommandTestc�6�|jdgtg��y�N�open�r,r-�r2r3r
s r�	test_openz#GenericBrowserCommandTest.test_open9����
�
�6��!�U�	�	$rN)rrr�
webbrowser�GenericBrowserr#r;rrrr5r55s���-�-�M�$rr5c�*�eZdZejZd�Zy)�BackgroundBrowserCommandTestc�6�|jdgtg��yr7r:r
s rr;z&BackgroundBrowserCommandTest.test_openCr<rN)rrrr=�BackgroundBrowserr#r;rrrr@r@?s���0�0�M�$rr@c�<�eZdZejZd�Zd�Zd�Zd�Z	y)�ChromeCommandTestc�6�|jdgtg��yr7r:r
s rr;zChromeCommandTest.test_openMr<rc�L�|jdtd��gtg��y�Nr8F��	autoraise�rr,r-�r2�dictr3r
s r�test_open_with_autoraise_falsez0ChromeCommandTest.test_open_with_autoraise_falseR�$���
�
�6�d�U�3��!�U�	�	$rc�8�|jddgtg��y�N�open_newz--new-windowr9r:r
s r�
test_open_newzChromeCommandTest.test_open_newW� ���
�
�:�*�+�!�U�	�	$rc�6�|jdgtg��y�N�open_new_tabr9r:r
s r�test_open_new_tabz#ChromeCommandTest.test_open_new_tab\����
�
�>��!�U�	�	$rN)
rrrr=�Chromer#r;rMrRrWrrrrDrDIs!���%�%�M�$�
$�
$�
$rrDc�<�eZdZejZd�Zd�Zd�Zd�Z	y)�EdgeCommandTestc�6�|jdgtg��yr7r:r
s rr;zEdgeCommandTest.test_openfr<rc�L�|jdtd��gtg��yrGrKr
s rrMz.EdgeCommandTest.test_open_with_autoraise_falsekrNrc�8�|jddgtg��yrPr:r
s rrRzEdgeCommandTest.test_open_newprSrc�6�|jdgtg��yrUr:r
s rrWz!EdgeCommandTest.test_open_new_taburXrN)
rrrr=�Edger#r;rMrRrWrrrr[r[bs���O�O�M�$�
$�
$�
$rr[c�<�eZdZejZd�Zd�Zd�Zd�Z	y)�MozillaCommandTestc�6�|jdgtg��yr7r:r
s rr;zMozillaCommandTest.test_openr<rc�L�|jdtd��gtg��yrGrKr
s rrMz1MozillaCommandTest.test_open_with_autoraise_false�rNrc�8�|jdgdtg��y)NrQz-new-windowr9r:r
s rrRz MozillaCommandTest.test_open_new�s ���
�
�:��+�S�1�	�	3rc�8�|jdgdtg��y)NrVz-new-tabr9r:r
s rrWz$MozillaCommandTest.test_open_new_tab�s ���
�
�>��(�#�.�	�	0rN)
rrrr=�Mozillar#r;rMrRrWrrrrbrb{s!���&�&�M�$�
$�
3�
0rrbc�<�eZdZejZd�Zd�Zd�Zd�Z	y)�EpiphanyCommandTestc�8�|jddgtg��y)Nr8�-nr9r:r
s rr;zEpiphanyCommandTest.test_open�s���
�
�6� �6�!�U�	�	$rc�P�|jdtd��ddgtg��y)Nr8FrHz-noraiserkrJrKr
s rrMz2EpiphanyCommandTest.test_open_with_autoraise_false�s)���
�
�6�d�U�3�&��-�!�U�	�	$rc�8�|jddgtg��y)NrQ�-wr9r:r
s rrRz!EpiphanyCommandTest.test_open_new�s���
�
�:� �6�!�U�	�	$rc�8�|jddgtg��y)NrVrnr9r:r
s rrWz%EpiphanyCommandTest.test_open_new_tab�s���
�
�>� �6�!�U�	�	$rN)
rrrr=�Epiphanyr#r;rMrRrWrrrriri�s!���'�'�M�$�
$�
$�
$rric�<�eZdZejZd�Zd�Zd�Zd�Z	y)�OperaCommandTestc�6�|jdgtg��yr7r:r
s rr;zOperaCommandTest.test_open�r<rc�L�|jdtd��gtg��yrGrKr
s rrMz/OperaCommandTest.test_open_with_autoraise_false�rNrc�8�|jddgtg��yrPr:r
s rrRzOperaCommandTest.test_open_new�rSrc�6�|jdgtg��yrUr:r
s rrWz"OperaCommandTest.test_open_new_tab�rXrN)
rrrr=�Operar#r;rMrRrWrrrrrrr�s!���$�$�M�$�
$�
$�
$rrrc�<�eZdZejZd�Zd�Zd�Zd�Z	y)�ELinksCommandTestc�V�|jddgdjt�g��y�Nr8�-remotezopenURL({})r9�r2�formatr3r
s rr;zELinksCommandTest.test_open�s+���
�
�6�I�;�&3�&:�&:�3�&?�%@�	�	Brc�V�|jddgdjt�g��yr{r}r
s rrMz0ELinksCommandTest.test_open_with_autoraise_false�s+���
�
�6�%�;�+�2�2�3�7�8�	�	:rc�V�|jddgdjt�g��y)NrQr|zopenURL({},new-window)r9r}r
s rrRzELinksCommandTest.test_open_new�s,���
�
�:�%�;�6�=�=�c�B�C�	�	Erc�V�|jddgdjt�g��y)NrVr|zopenURL({},new-tab)r9r}r
s rrWz#ELinksCommandTest.test_open_new_tab�s,���
�
�>�%�;�3�:�:�3�?�@�	�	BrN)
rrrr=�Elinksr#r;rMrRrWrrrryry�s$���%�%�M�B�:�
E�
Brryc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�BrowserRegistrationTestc��tj|_gt_tj|_it_yr)r=�	_tryorder�_saved_tryorder�	_browsers�_saved_browsersr
s r�setUpzBrowserRegistrationTest.setUp�s.��)�3�3���!�
��)�3�3���!�
�rc�X�|jt_|jt_yr)r�r=r�r�r�r
s r�tearDownz BrowserRegistrationTest.tearDown�s��#�3�3�
��#�3�3�
�rc�x�Gd�d�}g}i}|jtj|�|jtj|�tjd|�dg}|dg|d<|jtj|�|jtj|�|�}|�tjd|||��ntjd||�|rddg}nddg}||g|d<|jtj|�|jtj|�y)Nc��eZdZy)�CBrowserRegistrationTest._check_registration.<locals>.ExampleBrowserN�rrrrrr�ExampleBrowserr�����rr��Example1�example1�example2��	preferred)r'r=r�r��register)rr�r��expected_tryorder�expected_browsers�instances      r�_check_registrationz+BrowserRegistrationTest._check_registration�s.��	�	���������-�-�/@�A�����-�-�/@�A����J��7�'�L��)7��(>��*�%�����-�-�/@�A�����-�-�/@�A�!�#��� ����
�N�H�*3�
5�
���
�N�H�E��!+�Z� 8��!+�Z� 8��)7��(B��*�%�����-�-�/@�A�����-�-�/@�Arc�(�|jd��y)NFr��r�r
s r�
test_registerz%BrowserRegistrationTest.test_register	s��� � �5� �1rc�(�|jd��y)Nr�r�r
s r�test_register_defaultz-BrowserRegistrationTest.test_register_default���� � �4� �0rc�(�|jd��y)NTr�r�r
s r�test_register_preferredz/BrowserRegistrationTest.test_register_preferredr�rN)	rrrr�r�r�r�r�r�rrrr�r��s!��"�4�B�<2�1�1rr�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
ImportTestc��tjd�}|j|j�|j	|j
�Gd�d�}|jd|�|j|j�|j|jdd�|j|j
�|jd|j
�|j|j
d|dg�y)Nr=c��eZdZy)�0ImportTest.test_register.<locals>.ExampleBrowserNr�rrrr�r�r�rr�r����r�)
r�import_fresh_module�assertIsNoner��assertFalser�r��
assertTruer'r))rr=r�s   rr�zImportTest.test_registers���"�6�6�|�D�
����*�.�.�/�����-�-�.�	�	��
���J��7����
�,�,�-�����-�-�b�1�:�>����
�,�,�-��
�
�j�*�"6�"6�7�����-�-�j�9�N�D�;Q�Rrc�T�tjd�}|j|j�|j	|j
�|j
|j�5|jd�ddd�|j|j�y#1swY�%xYw)Nr=�fakebrowser)
rr�r�r�r�r��assertRaises�Error�get�assertIsNotNone)rr=s  r�test_getzImportTest.test_get"s~��"�6�6�|�D�
����*�.�.�/�����-�-�.�
�
�
�z�/�/�
0��J�N�N�=�)�1����Z�1�1�2�1�
0�s�'B�B'c�,�tjd�}tjj	t
j�j�}|j|d|j|��|jt
j�y)Nr=)rr��os�path�basename�sys�
executable�lowerr�r>r�)rr=r s   r�test_synthesizezImportTest.test_synthesize+sg��"�6�6�|�D�
��w�w������/�5�5�7���
���D�$�(A�
�(A�(A�$�(G�H��
���s�~�~�&rc�z�tjd�}	|j�j}tj�5}|d<tjd�}|j�ddd�y#|j$r$}|jt
|��Yd}~�wd}~wwxYw#1swYyxYw)Nr=�BROWSER)	rr�r�r r��skipTest�strr�EnvironmentVarGuard)rr=r/�err�envs     r�test_environmentzImportTest.test_environment1s���"�6�6�|�D�
�	$�$�j�n�n�&�+�+�G��
*�
*�
,��$�C�	�N�&�:�:�<�H�J��J�N�N��-�
,�����	$��M�M�#�c�(�#�#��	$��
,�
,�s#�A;�,B1�;B.�
B)�)B.�1B:c��tjd�}	|j�|j|jd�j}tj�5}|d<tjd�}|j|j�j|�ddd�tj�5}tj|d<tjd�}|j|j�jtj�ddd�y#|j
tf$r%}|jt|��Yd}~��d}~wwxYw#1swY��xYw#1swYyxYw)Nr=r�r�)rr�r�r�r r��
IndexErrorr�r�rr�r'r�r�)rr=�least_preferred_browserr�r�s     r�test_environment_preferredz%ImportTest.test_environment_preferred<s-��"�6�6�|�D�
�	$��J�N�N��&4�j�n�n�Z�5I�5I�"�5M�&N�&S�&S�#��
*�
*�
,��4�C�	�N�&�:�:�<�H�J����^�Z�^�^�-�2�2�4K�L�-�
�
*�
*�
,�� �^�^�C�	�N�&�:�:�<�H�J����^�Z�^�^�-�2�2�C�N�N�C�-�
,��� � �*�-�	$��M�M�#�c�(�#�#��	$��-�
,��
-�
,�s1�:D2�%AE/�A"E;�2E,�E'�'E,�/E8�;FN)rrrr�r�r�r�r�rrrr�r�s��S�3�'�	�Drr��__main__)r=�unittestr�r�r"rrr�test.supportrr�has_subprocess_support�SkipTestr3r$�	MagicMockr	r�TestCaser5r@rDr[rbrirrryr�r�r�mainrrr�<module>r�sM����	�
����&�"��%�%�
�(�
�
�@�
A�A����������0�0�4$� 0�(�2C�2C�$�$�#3�X�5F�5F�$�$�(�(�*;�*;�$�2$�&��(9�(9�$�20�)�8�+<�+<�0�2$�*�H�,=�,=�$�2$�'��):�):�$�2B�(�(�*;�*;�B�021�h�/�/�21�j9D��"�"�9D�x�Z���H�M�M�O�r

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