HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_webbrowser.cpython-310.opt-1.pyc
o

�ib*�@s\ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
dZdZGdd	�d	ej
�ZGd
d�d�ZGdd
�d
eej�ZGdd�deej�ZGdd�deej�ZGdd�deej�ZGdd�deej�ZGdd�deej�ZGdd�deej�ZGdd�deej�ZGdd�dej�ZGdd�dej�Zed kr�e��dSdS)!�N)�mock)�support)�
import_helper)�	os_helperzhttp://www.example.com�testc@seZdZdd�Zddd�ZdS)�	PopenMockcC�dS�Nr���selfr
r
�1/usr/local/lib/python3.10/test/test_webbrowser.py�poll�zPopenMock.pollNcCrr	r
)rZsecondsr
r
r
�waitrzPopenMock.wait�N)�__name__�
__module__�__qualname__rrr
r
r
r
rsrc@seZdZegid�dd�ZdS)�CommandTestMixin)�args�kwc
Cs�t�}t�|td|�|jtd�}t||�|i|��tjjdd}|�	|dt�|�
d�|D]}	|�|	|�|�
|�|	��q2|�	||�dS)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)
rrZpatch�
subprocess�
browser_class�CMD_NAME�getattrrZ	call_args�assertEqual�pop�assertIn�index)
r�methrr�options�	arguments�popen�browserZ
popen_args�optionr
r
r
�_tests
zCommandTestMixin._testN)rrr�URLr(r
r
r
r
rsrc@�eZdZejZdd�ZdS)�GenericBrowserCommandTestcC�|jdgtgd�dS�N�open�r#r$�r(r)rr
r
r
�	test_open7�
�z#GenericBrowserCommandTest.test_openN)rrr�
webbrowser�GenericBrowserrr1r
r
r
r
r+3�r+c@r*)�BackgroundBrowserCommandTestcCr,r-r0rr
r
r
r1Ar2z&BackgroundBrowserCommandTest.test_openN)rrrr3ZBackgroundBrowserrr1r
r
r
r
r6=r5r6c@�2eZdZejZdd�Zdd�Zdd�Zdd�Z	d	S)
�ChromeCommandTestcCr,r-r0rr
r
r
r1Kr2zChromeCommandTest.test_opencC�|jdtdd�gtgd�dS�Nr.F�Z	autoraise�rr#r$�r(�dictr)rr
r
r
�test_open_with_autoraise_falseP�
�z0ChromeCommandTest.test_open_with_autoraise_falsecC�|jddgtgd�dS�N�open_newz--new-windowr/r0rr
r
r
�
test_open_newU�
�zChromeCommandTest.test_open_newcCr,�N�open_new_tabr/r0rr
r
r
�test_open_new_tabZr2z#ChromeCommandTest.test_open_new_tabN)
rrrr3ZChromerr1r?rDrHr
r
r
r
r8G�r8c@r7)
�MozillaCommandTestcCr,r-r0rr
r
r
r1dr2zMozillaCommandTest.test_opencCr9r:r=rr
r
r
r?ir@z1MozillaCommandTest.test_open_with_autoraise_falsecC�|jdgdtgd�dS)NrCz-new-windowr/r0rr
r
r
rDn�
�z MozillaCommandTest.test_open_newcCrK)NrGz-new-tabr/r0rr
r
r
rHsrLz$MozillaCommandTest.test_open_new_tabN)
rrrr3ZMozillarr1r?rDrHr
r
r
r
rJ`rIrJc@r7)
�NetscapeCommandTestcC� |jdddgd�t�gd�dS)Nr.�-raise�-remote�openURL({})r/�r(�formatr)rr
r
r
r1}�

�zNetscapeCommandTest.test_opencCs(|jdtdd�ddgd�t�gd�dS)Nr.Fr;�-noraiserPrQr<)r(r>rSr)rr
r
r
r?�s

�z2NetscapeCommandTest.test_open_with_autoraise_falsecCrN)NrCrOrP�openURL({},new-window)r/rRrr
r
r
rD�rTz!NetscapeCommandTest.test_open_newcCrN)NrGrOrP�openURL({},new-tab)r/rRrr
r
r
rH�rTz%NetscapeCommandTest.test_open_new_tabN)
rrrr3ZNetscaperr1r?rDrHr
r
r
r
rMyrIrMc@r7)
�GaleonCommandTestcCrA)Nr.�-nr/r0rr
r
r
r1�rEzGaleonCommandTest.test_opencCs"|jdtdd�ddgtgd�dS)Nr.Fr;rUrYr<r=rr
r
r
r?�s
�z0GaleonCommandTest.test_open_with_autoraise_falsecCrA)NrC�-wr/r0rr
r
r
rD�rEzGaleonCommandTest.test_open_newcCrA)NrGrZr/r0rr
r
r
rH�rEz#GaleonCommandTest.test_open_new_tabN)
rrrr3ZGaleonrr1r?rDrHr
r
r
r
rX�rIrXc@r7)
�OperaCommandTestcCr,r-r0rr
r
r
r1�r2zOperaCommandTest.test_opencCr9r:r=rr
r
r
r?�r@z/OperaCommandTest.test_open_with_autoraise_falsecCrArBr0rr
r
r
rD�rEzOperaCommandTest.test_open_newcCr,rFr0rr
r
r
rH�r2z"OperaCommandTest.test_open_new_tabN)
rrrr3ZOperarr1r?rDrHr
r
r
r
r[�rIr[c@r7)
�ELinksCommandTestcC�|jddgd�t�gd�dS�Nr.rPrQr/rRrr
r
r
r1�s


�zELinksCommandTest.test_opencCr]r^rRrr
r
r
r?��

�z0ELinksCommandTest.test_open_with_autoraise_falsecCr])NrCrPrVr/rRrr
r
r
rD�r_zELinksCommandTest.test_open_newcCr])NrGrPrWr/rRrr
r
r
rH�r_z#ELinksCommandTest.test_open_new_tabN)
rrrr3ZElinksrr1r?rDrHr
r
r
r
r\�sr\c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�BrowserRegistrationTestcCs tj|_gt_tj|_it_dSr)r3�	_tryorder�_saved_tryorder�	_browsers�_saved_browsersrr
r
r
�setUp�s
zBrowserRegistrationTest.setUpcCs|jt_|jt_dSr)rbr3rardrcrr
r
r
�tearDown�sz BrowserRegistrationTest.tearDowncCs�Gdd�d�}g}i}|�tj|�|�tj|�t�d|�dg}|dg|d<|�tj|�|�tj|�|�}|durGtjd|||d�nt�d||�|rUddg}nddg}||g|d<|�tj|�|�tj|�dS)Nc@�eZdZdS)zCBrowserRegistrationTest._check_registration.<locals>.ExampleBrowserN�rrrr
r
r
r
�ExampleBrowser��ri�Example1�example1Zexample2��	preferred)rr3rarc�register)rrnriZexpected_tryorderZexpected_browsers�instancer
r
r
�_check_registration�s,
�
z+BrowserRegistrationTest._check_registrationcC�|jdd�dS)NFrm�rqrr
r
r
�
test_register�z%BrowserRegistrationTest.test_registercCs|jdd�dS)Nrmrsrr
r
r
�test_register_default
ruz-BrowserRegistrationTest.test_register_defaultcCrr)NTrmrsrr
r
r
�test_register_preferred
ruz/BrowserRegistrationTest.test_register_preferredN)	rrrrerfrqrtrvrwr
r
r
r
r`�sr`c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
ImportTestcCs�t�d�}|�|j�|�|j�Gdd�d�}|�d|�|�|j�|�|jdd�|�|j�|�	d|j�|�|jd|dg�dS)Nr3c@rg)z0ImportTest.test_register.<locals>.ExampleBrowserNrhr
r
r
r
rirjrirk���rl)
r�import_fresh_module�assertIsNonera�assertFalsercroZ
assertTruerr )rr3rir
r
r
rts
zImportTest.test_registercCsht�d�}|�|j�|�|j�|�|j��
|�d�Wd�n1s'wY|�	|j�dS)Nr3Zfakebrowser)
rrzr{rar|rcZassertRaises�Error�getZassertIsNotNone)rr3r
r
r
�test_get s
�zImportTest.test_getcCs@t�d�}tj�tj���}|�|d|�	|��|�
tj�dS)Nr3)rrz�os�path�basename�sys�
executable�lowerror4r~)rr3rr
r
r
�test_synthesize)s
zImportTest.test_synthesizec
Cs�t�d�}z|��j}Wn|jtfy(}z
|�t|��WYd}~nd}~wwt�	��}||d<t�d�}|��Wd�dS1sFwYdS)Nr3�BROWSER)
rrzr~rr}�AttributeError�skipTest�strr�EnvironmentVarGuard)rr3r&�err�envr
r
r
�test_environment/s
��


"�zImportTest.test_environmentc
Cst�d�}z|��|�|jd�j}Wn|jttfy1}z
|�t	|��WYd}~nd}~wwt
���}||d<t�d�}|�|��j|�Wd�n1sSwYt
���}t
j|d<t�d�}|�|��jt
j�Wd�dS1s|wYdS)Nr3ryr�)rrzr~rarr}r��
IndexErrorr�r�rr�rr�r�)rr3Zleast_preferred_browserr�r�r
r
r
�test_environment_preferred:s$
��

�


"�z%ImportTest.test_environment_preferredN)rrrrtrr�r�r�r
r
r
r
rxs	rx�__main__)r3Zunittestr�r�rrrrZtest.supportrrr)rZ	MagicMockrrZTestCaser+r6r8rJrMrXr[r\r`rxr�mainr
r
r
r
�<module>s4	

5<�