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: //proc/self/root/usr/local/lib/python3.7/test/__pycache__/test_webbrowser.cpython-37.opt-2.pyc
B

��g�)�@sBddlZddlZddlZddlZddlZddlmZddlmZdZdZ	Gdd�dej
�ZGdd	�d	�ZGd
d�deej
�ZGdd
�d
eej
�ZGdd�deej
�ZGdd�deej
�ZGdd�deej
�ZGdd�deej
�ZGdd�deej
�ZGdd�deej
�ZGdd�dej
�ZGdd�dej
�Zedk�r>e��dS)�N)�mock)�supportzhttp://www.example.com�testc@seZdZdd�Zddd�ZdS)�	PopenMockcCsdS)Nr�)�selfrr�0/usr/local/lib/python3.7/test/test_webbrowser.py�pollszPopenMock.pollNcCsdS)Nrr)rZsecondsrrr�waitszPopenMock.wait)N)�__name__�
__module__�__qualname__r	r
rrrrrsrc@seZdZegid�dd�ZdS)�CommandTestMixin)�args�kwc
Cs�t�}t�|td|�|jtd�}t||�||�tjjdd}|�	|dt�|�
d�x(|D] }	|�|	|�|�
|�|	��qbW|�	||�dS)N�Popen)�namer)
rrZpatch�
subprocess�
browser_class�CMD_NAME�getattrr�	call_args�assertEqual�pop�assertIn�index)
rZmethrr�options�	arguments�popen�browserZ
popen_args�optionrrr�_tests

zCommandTestMixin._testN)rrr
�URLr!rrrrrsrc@seZdZejZdd�ZdS)�GenericBrowserCommandTestcCs|jdgtgd�dS)N�open)rr)r!r")rrrr�	test_open5sz#GenericBrowserCommandTest.test_openN)rrr
�
webbrowser�GenericBrowserrr%rrrrr#1sr#c@seZdZejZdd�ZdS)�BackgroundBrowserCommandTestcCs|jdgtgd�dS)Nr$)rr)r!r")rrrrr%?sz&BackgroundBrowserCommandTest.test_openN)rrr
r&ZBackgroundBrowserrr%rrrrr(;sr(c@s2eZdZejZdd�Zdd�Zdd�Zdd�Z	d	S)
�ChromeCommandTestcCs|jdgtgd�dS)Nr$)rr)r!r")rrrrr%IszChromeCommandTest.test_opencCs|jdtdd�gtgd�dS)Nr$F)�	autoraise)rrr)r!�dictr")rrrr�test_open_with_autoraise_falseNsz0ChromeCommandTest.test_open_with_autoraise_falsecCs|jddgtgd�dS)N�open_newz--new-window)rr)r!r")rrrr�
test_open_newSszChromeCommandTest.test_open_newcCs|jdgtgd�dS)N�open_new_tab)rr)r!r")rrrr�test_open_new_tabXsz#ChromeCommandTest.test_open_new_tabN)
rrr
r&ZChromerr%r,r.r0rrrrr)Es
r)c@s2eZdZejZdd�Zdd�Zdd�Zdd�Z	d	S)
�MozillaCommandTestcCs|jdgtgd�dS)Nr$)rr)r!r")rrrrr%bszMozillaCommandTest.test_opencCs|jdtdd�gtgd�dS)Nr$F)r*)rrr)r!r+r")rrrrr,gsz1MozillaCommandTest.test_open_with_autoraise_falsecCs|jdgdtgd�dS)Nr-z-new-window)rr)r!r")rrrrr.lsz MozillaCommandTest.test_open_newcCs|jdgdtgd�dS)Nr/z-new-tab)rr)r!r")rrrrr0qsz$MozillaCommandTest.test_open_new_tabN)
rrr
r&ZMozillarr%r,r.r0rrrrr1^s
r1c@s2eZdZejZdd�Zdd�Zdd�Zdd�Z	d	S)
�NetscapeCommandTestcCs |jdddgd�t�gd�dS)Nr$z-raisez-remotezopenURL({}))rr)r!�formatr")rrrrr%{szNetscapeCommandTest.test_opencCs(|jdtdd�ddgd�t�gd�dS)Nr$F)r*z-noraisez-remotezopenURL({}))rrr)r!r+r3r")rrrrr,�sz2NetscapeCommandTest.test_open_with_autoraise_falsecCs |jdddgd�t�gd�dS)Nr-z-raisez-remotezopenURL({},new-window))rr)r!r3r")rrrrr.�sz!NetscapeCommandTest.test_open_newcCs |jdddgd�t�gd�dS)Nr/z-raisez-remotezopenURL({},new-tab))rr)r!r3r")rrrrr0�sz%NetscapeCommandTest.test_open_new_tabN)
rrr
r&ZNetscaperr%r,r.r0rrrrr2ws
r2c@s2eZdZejZdd�Zdd�Zdd�Zdd�Z	d	S)
�GaleonCommandTestcCs|jddgtgd�dS)Nr$z-n)rr)r!r")rrrrr%�szGaleonCommandTest.test_opencCs"|jdtdd�ddgtgd�dS)Nr$F)r*z-noraisez-n)rrr)r!r+r")rrrrr,�sz0GaleonCommandTest.test_open_with_autoraise_falsecCs|jddgtgd�dS)Nr-z-w)rr)r!r")rrrrr.�szGaleonCommandTest.test_open_newcCs|jddgtgd�dS)Nr/z-w)rr)r!r")rrrrr0�sz#GaleonCommandTest.test_open_new_tabN)
rrr
r&ZGaleonrr%r,r.r0rrrrr4�s
r4c@s2eZdZejZdd�Zdd�Zdd�Zdd�Z	d	S)
�OperaCommandTestcCs|jdgtgd�dS)Nr$)rr)r!r")rrrrr%�szOperaCommandTest.test_opencCs|jdtdd�gtgd�dS)Nr$F)r*)rrr)r!r+r")rrrrr,�sz/OperaCommandTest.test_open_with_autoraise_falsecCs|jddgtgd�dS)Nr-z--new-window)rr)r!r")rrrrr.�szOperaCommandTest.test_open_newcCs|jdgtgd�dS)Nr/)rr)r!r")rrrrr0�sz"OperaCommandTest.test_open_new_tabN)
rrr
r&ZOperarr%r,r.r0rrrrr5�s
r5c@s2eZdZejZdd�Zdd�Zdd�Zdd�Z	d	S)
�ELinksCommandTestcCs|jddgd�t�gd�dS)Nr$z-remotezopenURL({}))rr)r!r3r")rrrrr%�s
zELinksCommandTest.test_opencCs|jddgd�t�gd�dS)Nr$z-remotezopenURL({}))rr)r!r3r")rrrrr,�sz0ELinksCommandTest.test_open_with_autoraise_falsecCs|jddgd�t�gd�dS)Nr-z-remotezopenURL({},new-window))rr)r!r3r")rrrrr.�szELinksCommandTest.test_open_newcCs|jddgd�t�gd�dS)Nr/z-remotezopenURL({},new-tab))rr)r!r3r")rrrrr0�sz#ELinksCommandTest.test_open_new_tabN)
rrr
r&ZElinksrr%r,r.r0rrrrr6�s
r6c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�BrowserRegistrationTestcCs tj|_gt_tj|_it_dS)N)r&�	_tryorder�_saved_tryorder�	_browsers�_saved_browsers)rrrr�setUp�szBrowserRegistrationTest.setUpcCs|jt_|jt_dS)N)r9r&r8r;r:)rrrr�tearDown�sz BrowserRegistrationTest.tearDowncCs�Gdd�d�}g}i}|�tj|�|�tj|�t�d|�dg}|dg|d<|�tj|�|�tj|�|�}|dk	r�tjd|||d�nt�d||�|r�ddg}nddg}||g|d<|�tj|�|�tj|�dS)Nc@seZdZdS)zCBrowserRegistrationTest._check_registration.<locals>.ExampleBrowserN)rrr
rrrr�ExampleBrowser�sr>�Example1�example1Zexample2)�	preferred)rr&r8r:�register)rrAr>Zexpected_tryorderZexpected_browsers�instancerrr�_check_registration�s*


z+BrowserRegistrationTest._check_registrationcCs|jdd�dS)NF)rA)rD)rrrr�
test_registersz%BrowserRegistrationTest.test_registercCs|jdd�dS)N)rA)rD)rrrr�test_register_defaultsz-BrowserRegistrationTest.test_register_defaultcCs|jdd�dS)NT)rA)rD)rrrr�test_register_preferredsz/BrowserRegistrationTest.test_register_preferredN)	rrr
r<r=rDrErFrGrrrrr7�sr7c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
ImportTestcCs�t�d�}|�|j�|�|j�Gdd�d�}|�d|�|�|j�|�|jdd�|�|j�|�	d|j�|�|jd|dg�dS)Nr&c@seZdZdS)z0ImportTest.test_register.<locals>.ExampleBrowserN)rrr
rrrrr>sr>r?���r@)
r�import_fresh_module�assertIsNoner8�assertFalser:rBZ
assertTruerr)rr&r>rrrrEs
zImportTest.test_registerc	CsTt�d�}|�|j�|�|j�|�|j��|�d�WdQRX|�	|j�dS)Nr&Zfakebrowser)
rrJrKr8rLr:ZassertRaises�Error�getZassertIsNotNone)rr&rrr�test_gets
zImportTest.test_getcCs@t�d�}tj�tj���}|�|d|�	|��|�
tj�dS)Nr&)rrJ�os�path�basename�sys�
executable�lowerrBr'rN)rr&rrrr�test_synthesize's
zImportTest.test_synthesizec
Cs�t�d�}y|��j}Wn6|jtfk
rN}z|�t|��Wdd}~XYnXt��� }||d<t�d�}|��WdQRXdS)Nr&�BROWSER)	rrJrNrrM�AttributeError�skipTest�str�EnvironmentVarGuard)rr&r�err�envrrr�test_environment-s
 

zImportTest.test_environmentc
Cs�t�d�}y|��|�|jd�j}Wn8|jttfk
r`}z|�t	|��Wdd}~XYnXt�
��*}||d<t�d�}|�|��j|�WdQRXt�
��.}tj
|d<t�d�}|�|��jtj
�WdQRXdS)Nr&rIrW)rrJrNr8rrMrX�
IndexErrorrYrZr[rrSrT)rr&Zleast_preferred_browserr\r]rrr�test_environment_preferred8s
 




z%ImportTest.test_environment_preferredN)rrr
rErOrVr^r`rrrrrHs
	rH�__main__)r&ZunittestrPrSrrrrr"rZ	MagicMockrrZTestCaser#r(r)r1r2r4r5r6r7rHr�mainrrrr�<module>s,	

5<