403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.42
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Python315/Lib/test/test_profiling/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python315/Lib/test/test_profiling/__pycache__/test_heatmap.cpython-315.pyc
R
>lqjx�c�D�Qs]PHs]PHs]PHs]PHs]QHGs]QHGs\Q,QN2s	]QH(GsGsG
s
]QH8GsGsQQ\O"2sQQ	\O"2sQ
Q\O"2sQQ
\O"2sQsQQ\O"2sQQ\O"2sQQ2sQQ2sQQ2sQQ\O"2sQQ\O"2s\Q6Xc\O>2P!P!)z5Tests for the heatmap collector (profiling.sampling).)�
namedtuple)�Path�LocationInfo)�HeatmapCollector�get_python_path_info�extract_module_name)�captured_stdout�captured_stderrc�b`�\sQs]snQsQsQsQsQsQs	Qs
QsQ	sQ
s
QsQsUsP!)
�TestPathInfoFunctionsz2Test public helper functions for path information.c��[2oUOU[2UOQU2UOQU2UOQU2P!)zGTest that get_python_path_info returns a dictionary with expected keys.�stdlib�
site_packages�sys_path)r�assertIsInstance�dict�assertIn��self�	path_infos& �5C:\Python315\\Lib\test\test_profiling\test_heatmap.py�&test_get_python_path_info_returns_dict�<TestPathInfoFunctions.test_get_python_path_info_returns_dictsD��(�*�	����i��.��
�
�h�	�*��
�
�o�y�1��
�
�j�)�,�c�p�[2oUQ*d UOUQ*[2P!P!)z1Test that stdlib is either a Path object or None.r)rrrrs& r�0test_get_python_path_info_stdlib_is_path_or_none�FTestPathInfoFunctions.test_get_python_path_info_stdlib_is_path_or_none&s/��(�*�	��X��*��!�!�)�H�"5�t�<�+rc��[2oUOUQ*[2UQ*FDoUOU[2J	P!)z"Test that site_packages is a list.r
�rr�listr�rr�items&  r�/test_get_python_path_info_site_packages_is_list�ETestPathInfoFunctions.test_get_python_path_info_site_packages_is_list-sA��(�*�	����i��8�$�?��o�.�.�D��!�!�$��-�/rc��[2oUOUQ*[2UQ*FDoUOU[2J	P!)z-Test that sys_path is a list of Path objects.rrrs&  r�*test_get_python_path_info_sys_path_is_list�@TestPathInfoFunctions.test_get_python_path_info_sys_path_is_list5sA��(�*�	����i�
�3�T�:��j�)�)�D��!�!�$��-�*rc��[2o[PU2vq#UOUQ2UOUQ2P!)z,Test extract_module_name with None filename.�unknown�other�rr�assertEqual�rr�module_name�module_types&   r�"test_extract_module_name_with_none�8TestPathInfoFunctions.test_extract_module_name_with_none=s9��(�*�	�#6�t�Y�#G� ������i�0�����g�.rc��[2o[PU2vq#UOUQ2UOUQ2P!)z-Test extract_module_name with empty filename.r'r(r)r+s&   r�*test_extract_module_name_with_empty_string�@TestPathInfoFunctions.test_extract_module_name_with_empty_stringEs9��(�*�	�#6�r�9�#E� ������i�0�����g�.rc���[2oUQ*%cM[UQ*Q*2o[V!2vq4UOUQ2UO	QU2P!P!)z6Test extract_module_name with a standard library file.rzos.py�os)r�strrr*r)rr�stdlib_filer,r-s&    r�)test_extract_module_name_with_stdlib_file�?TestPathInfoFunctions.test_extract_module_name_with_stdlib_fileMs[��(�*�	��X����i��1�G�;�<�K�':�;�'R�$�K����[�(�3��M�M�$��,�rc��[2oUQ*%c&Qo[V!2vq4UOUQQ,2P!P!)z-Test extract_module_name with a project file.rz/some/project/path/mymodule.py�projectr()rrr)rr�project_filer,r-s&    r�*test_extract_module_name_with_project_file�@TestPathInfoFunctions.test_extract_module_name_with_project_fileYsC��(�*�	��Z� � �;�L�':�<�'S�$�K�
�M�M�+�	�7�';�<�
!rc�\�[2o[QU2vq#UOQU2P!)z5Test that .py extension is removed from module names.z/path/to/test.pyz.py)rr�assertNotInr+s&   r�-test_extract_module_name_removes_py_extension�CTestPathInfoFunctions.test_extract_module_name_removes_py_extensionfs.��(�*�	�$7�7I�9�#U� ��	
�����,rc�v�[2o,QNoSFD"o[V12vqEUOUQ2J$	P!)z>Test extract_module_name with special filenames like <string>.r()�<string>z<stdin>�[eval]r))rr�
special_files�special_filer,r-s&     r�+test_extract_module_name_with_special_files�ATestPathInfoFunctions.test_extract_module_name_with_special_filesps6��(�*�	�9�
�)�L�':�<�'S�$�K����[�'�2�*r�)�__name__�
__module__�__qualname__�__firstlineno__�__doc__rrr!r$r.r1r7r<r@rG�__static_attributes__�__classdictcell__��
__classdict__s@rr
r
s?����<�-�=�.�.�/�/�
-�=�-�3�3rr
c�8`�\sQs]~snQsQsQsQsQsUs	P!)�TestHeatmapCollectorInitz%Test HeatmapCollector initialization.c�H�[]dQ5oUOUO[2UOUO[2UOUO
[2UOUO[2UOUO[2UOUO[2UOUO[2UOUO[2UO[UO2]2UO[UO2]2UO[UO
2]2UO[UO2]2P!)z1Test that __init__ creates empty data structures.��sample_interval_usec)
rr�line_samplesr�file_samples�line_self_samples�file_self_samples�
call_graph�
callers_graph�function_definitions�edge_samplesr*�len�r�	collectors& r�'test_init_creates_empty_data_structures�@TestHeatmapCollectorInit.test_init_creates_empty_data_structures�s,��$�#�>�	�	
���i�4�4�d�;����i�4�4�d�;����i�9�9�4�@����i�9�9�4�@����i�2�2�D�9����i�5�5�t�<����i�<�<�d�C����i�4�4�d�;�	
����Y�3�3�4�a�8�����Y�3�3�4�a�8�����Y�8�8�9�1�=�����Y�8�8�9�1�=rc�X�[]dQ5oUOUO]2P!)z'Test that total samples starts at zero.rV)rr*�_total_samplesras& r�$test_init_sets_total_samples_to_zero�=TestHeatmapCollectorInit.test_init_sets_total_samples_to_zero�s"��$�#�>�	�����1�1�1�5rc��[]dQ5oUOUO2UOQUO2P!)z-Test that path info is retrieved during init.rVr)r�assertIsNotNone�
_path_inforras& r�test_init_gets_path_info�1TestHeatmapCollectorInit.test_init_gets_path_info�s4��$�#�>�	����Y�1�1�2��
�
�h�	� 4� 4�5rrI)
rJrKrLrMrNrcrgrlrOrPrQs@rrTrT~s����/�>�(6�
6�6rrTc�>`�\sQs]�snQsQsQsQsQsQs	Us
P!)�TestHeatmapCollectorSetStatsz)Test HeatmapCollector.set_stats() method.c�b�[]dQ5oUOQQQQQ5UOUOQ*Q2UOUOQ*Q2UOUOQ	*Q2UOUOQ
*Q2P!)z3Test that set_stats stores all provided parameters.rV��g%@g�X@g�?)rW�duration_sec�sample_rate�
error_raterWrrrsrt�r�	set_statsr*�statsras& r�$test_set_stats_stores_all_parameters�ATestHeatmapCollectorSetStats.test_set_stats_stores_all_parameters�s���$�#�>�	����!$����		�	
�	
������)?�@�#�F��������8�$�?��������7��>��������6��<rc���[]dQ5oUO]dQQQ5UOQUO2UOQUO2UOQUO2P!)z6Test that set_stats includes Python and platform info.rV��?�Y@�rWrrrs�python_version�python_implementation�platform)rrvrrwras& r�#test_set_stats_includes_system_info�@TestHeatmapCollectorSetStats.test_set_stats_includes_system_info�sZ��$�#�>�	�����3�TY��Z��
�
�&�	���8��
�
�-�y���?��
�
�j�)�/�/�2rc���[]dQ5oUO]dQQQ]*Q5UOUOQ*Q2UOUOQ*]*2P!)z.Test that set_stats accepts additional kwargs.rVr{r|�custom_value)rWrrrs�
custom_key�another_keyr�r�ruras& r�test_set_stats_accepts_kwargs�:TestHeatmapCollectorSetStats.test_set_stats_accepts_kwargs�sb��$�#�>�	����!$���%��	�	
�	
�������6��G��������7��<rc���[]dQ5oUO]dQQQ5UOQUO2UO	UOQ*2P!)z$Test set_stats with error_rate=None.rVr{r|r}rt)rrvrrw�assertIsNoneras& r�#test_set_stats_with_none_error_rate�@TestHeatmapCollectorSetStats.test_set_stats_with_none_error_rate�sK��$�#�>�	�����3�TY��Z��
�
�l�I�O�O�4����)�/�/�,�7�8rrI)rJrKrLrMrNrxr�r�r�rOrPrQs@rroro�s!����3�=� 3�
=�9�9rroc�n`�\sQs]�snQsQsQsQsQsQs	Qs
QsQ	sQ
s
QsQsQ
sQsUsP!)�!TestHeatmapCollectorProcessFramesz.Test HeatmapCollector.process_frames() method.c��[]dQ5oUOoQ,oUOU]Q5UOUOU]*2P!)z8Test that process_frames increments total samples count.rV��	thread_id��file.py��
r����r��funcN�rrf�process_framesr*)rrb�
initial_count�framess&   r�,test_process_frames_increments_total_samples�NTestHeatmapCollectorProcessFrames.test_process_frames_increments_total_samples�sM��$�#�>�	�!�0�0�
�=�>��� � ��1� �5�����1�1�=�1�3D�Erc���[]dQ5oQ,oUOU]Q5UOQUO2UO	UOQ*]2P!)z.Test that process_frames records line samples.rVr�)�test.py��r�r�r��	test_funcN)r�r�)rr�rrXr*�rrbr�s&  r�(test_process_frames_records_line_samples�JTestHeatmapCollectorProcessFrames.test_process_frames_records_line_samples�sX��$�#�>�	�@�A��� � ��1� �5�	
�
�
�n�i�&<�&<�=�����/�/��?��Crc��[]dQ5o,QNoUOU]Q5UOQUO2UOQUO2UOQUO2P!)z6Test that process_frames records all lines in a stack.rVr�)��file1.pyr��func1N��file2.py)�r�r�r��func2N��file3.py)�r�r�r��func3N)r�r�)r�r�)r�r�)rr�rrXr�s&  r�3test_process_frames_records_multiple_lines_in_stack�UTestHeatmapCollectorProcessFrames.test_process_frames_records_multiple_lines_in_stack�si��$�#�>�	�
��
	� � ��1� �5�	
�
�
�&�	�(>�(>�?��
�
�&�	�(>�(>�?��
�
�&�	�(>�(>�?rc��[]dQ5oQQ,oUOU]Q5UOQUO2UO	UOQ*]2UOQUO2P!)z;Test that process_frames distinguishes self (leaf) samples.rVr�)�leaf.pyr��	leaf_funcN��	caller.pyr��caller_funcN�r�r��r�r�)rr�rrZr*r?r�s&  r�.test_process_frames_distinguishes_self_samples�PTestHeatmapCollectorProcessFrames.test_process_frames_distinguishes_self_samples�sz��$�#�>�	�
;�@�
��	� � ��1� �5�	
�
�
�n�i�&A�&A�B�����4�4�^�D�a�H�	
���*�I�,G�,G�Hrc��[]dQ5oQ,oUOU]Q5UOU]Q5UOU]Q5UOUOQ*]2UOUO]2P!)z,Test that multiple calls accumulate samples.rVr�r�)r�r�)rr�r*rXrfr�s&  r�'test_process_frames_accumulates_samples�ITestHeatmapCollectorProcessFrames.test_process_frames_accumulates_sampless~��$�#�>�	�=�>��� � ��1� �5�� � ��1� �5�� � ��1� �5�����/�/��@�!�D�����1�1�1�5rc��[]dQ5o,QNoSFDoUOU,]Q5J	SFDGoU]*%fJUOU]*U]*]*1UO2JI	P!)z0Test that process_frames ignores invalid frames.rVr�))rC��r�r�r��testN)rDr�r�N)�r�r�N)Nr�r�N)�__init__)�r�r�r�r�N)rr�r?rX)rrb�invalid_frames�frames&   r�*test_process_frames_ignores_invalid_frames�LTestHeatmapCollectorProcessFrames.test_process_frames_ignores_invalid_framessp��$�#�>�	�
��$�E��$�$�e�W��$�:�$�$�E��Q�x�x�� � �%��(�E�!�H�Q�K�!8�)�:P�:P�Q�$rc���[]dQ5oQQ,oUOU]Q5QoUOV1O2QoUOVAO2P!)z9Test that process_frames builds call graph relationships.rVr�)�	callee.pyr��callee_funcNr�r��r�r�)rr�rr\r])rrbr��
caller_key�
callee_keys&    r�%test_process_frames_builds_call_graph�GTestHeatmapCollectorProcessFrames.test_process_frames_builds_call_graph0sb��$�#�>�	�
?�@�
��	� � ��1� �5�'�
��
�
�j�"6�"6�7�&�
��
�
�j�"9�"9�:rc���[]dQ5oQ,oUOU]Q5UOQUO2UO	UOQ*]*2P!)z?Test that process_frames records function definition locations.rVr�)�	module.py)�*r�r�r��my_functionN)r�r�)rr�rr^r*r�s&  r�0test_process_frames_records_function_definitions�RTestHeatmapCollectorProcessFrames.test_process_frames_records_function_definitionsBsY��$�#�>�	�F�G��� � ��1� �5��
�
�2�I�4R�4R�S�����7�7�8T�U�WY�Zrc��[]dQ5oQQ,oUOU]Q5UOU]Q5UO[UO2]2P!)z3Test that process_frames tracks edge sample counts.rVr��r�r��calleeN�r�r��callerN)rr��
assertGreaterr`r_r�s&  r�'test_process_frames_tracks_edge_samples�ITestHeatmapCollectorProcessFrames.test_process_frames_tracks_edge_samplesLs`��$�#�>�	�
:�;�
��	� � ��1� �5�� � ��1� �5�	
���3�y�5�5�6��:rc�&�[]dQ5oQQ,oUOU]]Q5QoUOUOU*]2UOUOQ*]2UOUOQ*]2P!)�drV)r��weightr�r�r�r�)r�r�)rr�r*r_rX)rrbr��edge_keys&   r�7test_process_frames_weight_applies_to_identical_samples�YTestHeatmapCollectorProcessFrames.test_process_frames_weight_applies_to_identical_samples\s���$�#�>�	�
:�;�
��
	� � ��1�Q� �?�8������/�/��9�1�=�����/�/�0@�A�1�E�����/�/�0A�B�A�Frc��[]dQ5oUOoUO,]Q5UOUOU]*2P!)z2Test that process_frames handles empty frame list.rVr�r�)rrbr�s&  r�(test_process_frames_handles_empty_frames�JTestHeatmapCollectorProcessFrames.test_process_frames_handles_empty_framesksG��$�#�>�	�!�0�0�
�� � ��q� �1�	
����1�1�=�1�3D�Erc��[]dQ5oQ,oUOU]Q5UOQUO2UO]
UOQ*2UO	UOQ*]
*]2P!)z2Test that file_samples dict is properly populated.rVr�r��r�r�r�N)rr�rrYr*r�s&  r�*test_process_frames_with_file_samples_dict�LTestHeatmapCollectorProcessFrames.test_process_frames_with_file_samples_dictust��$�#�>�	�=�>��� � ��1� �5��
�
�i��!7�!7�8��
�
�b�)�0�0��;�<�����/�/�	�:�2�>��BrrI)rJrKrLrMrNr�r�r�r�r�r�r�r�r�r�r�r�rOrPrQs@rr�r��sS����8�F�	D�@� I�"6�R�*;�$[�;� 
G�F�	C�	Crr�c��VUPP1UP1!)z=Create a frame tuple: (filename, location, funcname, opcode).rI)�filename�liner�s&&&rr�r��s���T�2�r�*�D�$�7�7rc�D`�\sQsQsnQsQsQsQsQsQs	Qs
UsP!)	�%TestHeatmapCollectorNavigationButtons�z�Test navigation button behavior for caller/callee relationships.

For every call stack:
- Root frames (entry points): only DOWN arrow (callees)
- Middle frames: both UP and DOWN arrows
- Leaf frames: only UP arrow (callers)
c�Z�[]dQ5oSFDoUOU]Q5J	U!)z*Create collector and process frame stacks.rVr�)rr�)r�stacksrb�stacks&*  r�collect�-TestHeatmapCollectorNavigationButtons.collect�s/��$�#�>�	��E��$�$�U�a�$�8���rc	��[Q]Q2[Q]
Q2[Q]Q2[Q]Q2[Q	]Q
2,oUOU2oUOQUO2UO	QUO
2QFD9oUOV2O2UOV2O
2J;	UO	Q
UO2UOQ
UO
2P!)z9Test root/middle/leaf navigation in a 5-level call stack.r��leaf�c.py�func_c�b.py�func_b�a.py�func_a�root.py�root)r�))rr�)r��)r�r�r�)r�r�rr\r?r])rr��c�keys&   r�"test_deep_call_stack_relationships�HTestHeatmapCollectorNavigationButtons.test_deep_call_stack_relationships�s���
�)�Q��'��&�"�h�'��&�"�h�'��&�"�h�'��)�R��(�
��
�L�L����	
�
�
�o�q�|�|�4�����!�/�/�:�>�C��M�M�#�|�|�,��M�M�#���/�>�
	
�������6��
�
�n�a�o�o�6rc
�~�UO[Q]Q2[Q]dQ2,[Q]Q2[Q]dQ2,[Q]
Q2[Q]dQ2,2oQFD(oUOUOQU1*Q2J*	UOQ*oUOQU1UO2P!)zATest that interior lines map to their function for caller lookup.�mod.py�my_funcr�r�)r��r)rr)r�r�r*�line_to_functionr^rr])rrr��func_defs&   r�&test_all_lines_in_function_see_callers�LTestHeatmapCollectorNavigationButtons.test_all_lines_in_function_see_callers�s���
�L�L�
�8�R��
+�U�;��X�-N�O�
�8�R��
+�U�;��X�-N�O�
�8�R��
+�U�;��X�-N�O�
��!�D����Q�/�/��4�0@�A�9�M�!��)�)�*?�@���
�
�x��*�A�O�O�<rc��UO[Q]
Q2[Q]Q2,[Q]
Q2[Q]Q2,[Q]Q2[Q	](Q
2,[Q]Q2[Q	](Q
2,2oUOQ
*oSOSTt.tFDp3]*jJ
	toQQ.2UOQ*oSOSTt.tFDp3]*jJ
	toQQ.2P!ttohttoh)z5Test multiple callers/callees are recorded correctly.�	target.py�targetz
caller1.py�c1z
caller2.py�c2z
callee1.py�f1�
dispatcher.py�dispatchz
callee2.py�f2)rr�)r�()r�r�r]r*r\)rr�callers�x�calleess&    r�!test_multiple_callers_and_callees�GTestHeatmapCollectorNavigationButtons.test_multiple_callers_and_callees�s���
�L�L�
�;��H�
-�u�\�2�t�/L�M�
�;��H�
-�u�\�2�t�/L�M�
�<��D�
)�5��"�j�+Q�R�
�<��D�
)�5��"�j�+Q�R�	
���/�/�"3�4������0��1�A�$�$��0�<��2N�O��,�,�4�5������0��1�A�$�$��0�<��2N�O��	1��1s�C4�C9c��[Q]
Q2[Q]Q2,oUOVU2oQoUOUOU*]2P!)z0Test that repeated calls accumulate edge counts.r�r�r�r�))r�r�)r�r�)r�r�r*r_)rr�rr�s&   r�test_edge_samples_counted�?TestHeatmapCollectorNavigationButtons.test_edge_samples_counted�sL���{�B��1�5��b�(�3S�T���L�L��u�-��9���������1�1�5rrI)rJrKrLrMrNr�rrrr"rOrPrQs@rr�r��s)������7�2=�"P�$6�6rr�c�\`�\sQsQsnQsQsQsQsQsQs	Qs
Q	sQ
sQs
QsUsP!)
�TestHeatmapCollectorExport��z&Test HeatmapCollector.export() method.c��[O2UmUO[O
UO2P!)zSet up test directory.)�tempfile�mkdtemp�test_dir�
addCleanup�shutil�rmtree�rs&r�setUp� TestHeatmapCollectorExport.setUp�s(�� �(�(�*��
�����
�
�t�}�}�5rc	�2�[]dQ5oQ,oUOU]Q5[OO	UO
Q2o[
29^tt^2[29^tt^2UOU2PPP2PPP2UO[OOU22UO[OOU22P!)%fhKv9h)%fhK�9h)z.Test that export creates the output directory.rVr��heatmap_outputr�)rr�r4�path�joinr*rr�export�
assertTrue�exists�isdir)rrbr��output_paths&   r�$test_export_creates_output_directory�?TestHeatmapCollectorExport.test_export_creates_output_directory�s���$�#�>�	�>�>��� � ��1� �5��g�g�l�l�4�=�=�2B�C��
�
�
�� 1� 1����[�)�!2�
�	
��������{�3�4�������
�
�k�2�3�	!2� 1��
�
�s0� D�3C3	�D�3D
�<D
�>D�D	�D	c	��[]dQ5oQ,oUOU]Q5[OO	UO
Q2o[
29^tt^2[29^tt^2UOU2PPP2PPP2[OO	UQ2oUO[OOU22P!)%fhKh9h)%fhKs9h)z$Test that export creates index.html.rVr�r2�
index.htmlr��rr�r4r3r4r*rrr5r6r7)rrbr�r9�
index_paths&    r�test_export_creates_index_html�9TestHeatmapCollectorExport.test_export_creates_index_html�s���$�#�>�	�=�>��� � ��1� �5��g�g�l�l�4�=�=�2B�C��
�
�
�� 1� 1����[�)�!2�
��W�W�\�\�+�|�<�
���������z�2�3�	!2� 1��
�
�s0� C8�3C%	�C8�%C5
�.C5
�0C8�8D	�D	c	�j�[]dQ5oQ,oUOU]Q5[OO	UO
Q2o[
29^tt^2[29^tt^2UOU2PPP2PPP2[OU2Tt,tFD7oUOQ2%fJUOQ2%fJ5UMJ9	ooUO[U2]2P!)%fhK�9h)%fhK�9httoh)z/Test that export creates individual file HTMLs.rVr�r2�file_�.htmlr�)rr�r4r3r4r*rrr5�listdir�
startswith�endswithr�r`)rrbr�r9�f�
html_filess&     r�test_export_creates_file_htmls�9TestHeatmapCollectorExport.test_export_creates_file_htmlss���$�#�>�	�=�>��� � ��1� �5��g�g�l�l�4�=�=�2B�C��
�
�
�� 1� 1����[�)�!2�
�"$���K�!8�H�!8�A����g�.��34�:�:�g�3F��a�!8�
�H����3�z�?�A�.�
!2� 1��
�
��HsB� D�3D
	�D�,D0�D0�%D0�
D
�D
�D�D-	�&D-	c	�P�[]dQ5o[OOUOQ2o[29^tt^2[
29^tt^2UOU2PPP2PPP2P!)%fhK9h)%fhP!9h)z#Test export with no data collected.rV�empty_output)rr4r3r4r*rrr5)rrbr9s&  r�test_export_with_empty_data�6TestHeatmapCollectorExport.test_export_with_empty_datasa��$�#�>�	��g�g�l�l�4�=�=�.�A���
�
�� 1� 1����[�)�!2�
�
� 1� 1��
�
�
�s0�
B�B	�/B�B
�
B
�B�B%	�B%	c	�*�[]dQ5oQ,oUOU]Q5[OO	UO
Q2o[
29^tt^2[29^tt^2UOU2PPP2PPP2[OO	UO
Q2oUO[OOU22P!)%fhKr9h)%fhK}9h)z5Test that export handles .html suffix in output path.rVr�zoutput.html�outputr�r>)rrbr�r9�expected_dirs&    r�test_export_handles_html_suffix�:TestHeatmapCollectorExport.test_export_handles_html_suffixs���$�#�>�	�=�>��� � ��1� �5��g�g�l�l�4�=�=�-�@��
�
�
�� 1� 1����[�)�!2�
��w�w�|�|�D�M�M�8�<����������|�4�5�!2� 1��
�
�s0� D�3C/	�D�/C?
�8C?
�:D�D	�D	c	��[]dQ5oUOQ,]Q5UOQ,]Q5UOQ,]Q5[OO	UO
Q2o[
29^tt^2[29^tt^2UOU2PPP2PPP2[OU2Tt,tFD7oUOQ2%fJUOQ2%fJ5UMJ9	ooUO[U2]2P!)%fhK�9h)%fhK�9httoh)	z Test export with multiple files.rVr��
multi_filerCrDr�r�r�)rr�r4r3r4r*rrr5rErFrG�assertGreaterEqualr`)rrbr9rHrIs&    r�test_export_with_multiple_files�:TestHeatmapCollectorExport.test_export_with_multiple_files.s��$�#�>�	�	� � �"O�!P�\]� �^�� � �"O�!P�\]� �^�� � �"O�!P�\]� �^��g�g�l�l�4�=�=�,�?��
�
�
�� 1� 1����[�)�!2�
�"$���K�!8�H�!8�A����g�.��34�:�:�g�3F��a�!8�
�H�����J���3�
!2� 1��
�
��HsB�E�D0	�+E�E�2E�E�0E
�9E
�;E�E	�E	c	��[]dQ5oUO]dQQQ5Q,oUOU]Q5[OOUOQ2o[29^tt^2[29^tt^2UOU2PPP2PPP2[OOUQ2o[UQQ	Q
59^tt^2oUO2oPPP2UOQW2P!)%fhK{9h)%fhK�9h)%fhKJ9h)
z;Test that index.html contains references to profiled files.rVr{r|r}r��test_outputr=�r�utf-8��encoding�mytest)z	mytest.pyr�rN)
rrvr�r4r3r4r*rrr5�open�readr)rrbr�r9r?rH�contents&      r�*test_export_index_contains_file_references�ETestHeatmapCollectorExport.test_export_index_contains_file_referencesAs���$�#�>�	�����3�TY��Z�B�C��� � ��1� �5��g�g�l�l�4�=�=�-�@��
�
�
�� 1� 1����[�)�!2�
��W�W�\�\�+�|�<�
�
�*�c�G�
4�
4���f�f�h�G�5�	
�
�
�h��(�!2� 1��
�
��5�
4�sB�4D�D	�D�D2�D
�D
�D�D/	�(D/	�2E	�;E	c	��[]dQ5o[OOUOQ2o[UQ29^tt^2oUO
Q2PPP2UQQP1,oUOU]Q5[OOUOQ2o[29^tt^2[29^tt^2UOU2PPP2PPP2[OU2Tt,tFD7oUOQ2%fJUOQ	2%fJ5UMJ9	ooU%ch[[OOVV]*2Q
QQ59^tt^2oUO2oPPP2UOQ
W2P!P!)%fhCKe9h)%fhK�9h)%fhCK9httoh)%fhKf9h)z3Test that exported file HTML contains line numbers.rVztemp_source.py�wzdef test():
    pass
r�r��	line_testrCrDr\r]r^zline-r�)rr4r3r4r*ra�writer�rrr5rErFrGrbr)rrb�	temp_filerHr�r9rIrcs&       r�&test_export_file_html_has_line_numbers�ATestHeatmapCollectorExport.test_export_file_html_has_line_numbersUsr��$�#�>�	��G�G�L�L����0@�A�	�
�)�S�
!�
!�Q�
�G�G�-�.�"��n�f�d�;�<��� � ��1� �5��g�g�l�l�4�=�=�+�>��
�
�
�� 1� 1����[�)�!2�
�"$���K�!8�H�!8�A����g�.��34�:�:�g�3F��a�!8�
�H���b�g�g�l�l�;�1�
�>��g�V�V�Z[��&�&�(��W�
�M�M�'�7�+��"�
!�
!��!2� 1��
�
�
��H�W�V�sf�F:�<G!�G	�!G!�G5�(G5�G5�G:�:G	�G	�G
�G
�G!�!G2	�*G2	�:H
	�H
	)r*)rJrKrLrMrNr/r:r@rJrNrSrXrdrkrOrPrQs@rr%r%�s:����0�6�
4� 
4�/�"*�6�"4�&)�(,�,rr%c�H`�\sQsQsnQsQ	QksQsQsQsQs	Qs
UsP!)
�
MockFrameInfo�rz�Mock FrameInfo for testing.

Frame format: (filename, location, funcname, opcode) where:
- location is a tuple (lineno, end_lineno, col_offset, end_col_offset)
- opcode is an int or None
c�@�VmV0mV@mV"PP1UmP!)r�)r��funcname�opcode�location)rr��linenorqrrs&&&&&rr��MockFrameInfo.__init__zs�� �
� �
�����R�0��
rc�r�[UOUOUOUO12!�N)�iterr�rsrqrrr.s&r�__iter__�MockFrameInfo.__iter__�s&���T�]�]�D�M�M�4�=�=�$�+�+�N�O�Orc�n�UOUOUOUO1U*!rw�r�rsrqrr)r�indexs&&r�__getitem__�MockFrameInfo.__getitem__�s&���
�
�t�}�}�d�m�m�T�[�[�I�%�P�Prc��]!)�rIr.s&r�__len__�MockFrameInfo.__len__�s��rc	�r�QUOQUOQUOQUOQ0	!)zMockFrameInfo('z', z, '�)r|r.s&r�__repr__�MockFrameInfo.__repr__�s9�� �����s�4�=�=�/��T�]�]�O�SV�W[�Wb�Wb�Vc�cd�e�er)r�rqrsrrrw)rJrKrLrMrNr�ryr~r�r�rOrPrQs@rrnrnrs,�����1�P�Q��f�frrnc�6`�\sQsQsnQsQQksQsQsUsP!)�MockThreadInfo�z@Mock ThreadInfo for testing since the real one isn't accessible.c�,�VmV mV0mP!rw)r��
frame_info�status)rr�r�r�s&&&&rr��MockThreadInfo.__init__�s��"��$���rc�>�QUOQUOQ0!)zMockThreadInfo(thread_id=z
, frame_info=r�)r�r�r.s&rr��MockThreadInfo.__repr__�s"��*�4�>�>�*:�-����GX�XY�Z�Zr)r�r�r�)r��	rJrKrLrMrNr�r�rOrPrQs@rr�r��s����J��
[�[rr�c�2`�\sQsQsnQsQsQsQsUsP!)�MockInterpreterInfo�zEMock InterpreterInfo for testing since the real one isn't accessible.c� �VmV mP!rw��interpreter_id�threads)rr�r�s&&&rr��MockInterpreterInfo.__init__�s
��,���rc�>�QUOQUOQ0!)z#MockInterpreterInfo(interpreter_id=z
, threads=r�r�r.s&rr��MockInterpreterInfo.__repr__�s'��4�T�5H�5H�4I��TX�T`�T`�Sa�ab�c�crr�r�rQs@rr�r��s����O��d�drr�c�2`�\sQsQsnQsQsQsQsUsP!)�TestHeatmapCollector�z)Tests for HeatmapCollector functionality.c��[]dQ5oUO[UO2]2UO[UO2]2[][
][Q]
Q2[Q]Q2,2,2,oUOU2UO[UO2]2UOQUO2UOQ*oUO[U2]2P!)z*Test basic HeatmapCollector functionality.rVr�r�r�)rr*r`rYrXr�r�rnr�r�r)rrb�test_frames�	file_datas&   r�test_heatmap_collector_basic�1TestHeatmapCollector.test_heatmap_collector_basic�s���$�#�>�	�	
����Y�3�3�4�a�8�����Y�3�3�4�a�8�
 ����"�9�b�'�:�M�)�UW�Y`�<a�b���
�
��	���+�&�	
���3�y�5�5�6��:��
�
�i��!7�!7�8��*�*�9�5�	����3�y�>�1�-rc�,�[O2oUO[OU2[]dQ5o[
][][Q]
Q2[Q]Q2,2,2,o[
][][Q]
Q2[Q]Q2,2,2,o[
][][Q]Q2,2,2,oUOU2UOU2UOU2[29^tt^2[29^tt^2UOU2PPP2PPP2[OOUQ2oUO![OO#U22UO%[OO'U2]2[)UQQ	Q
59^tt^2oUO+2oPPP2UO-QWO/22UO-QU2UO-Q
U2UO-QU2UO-QU2[O0U2Tt,tFD6pwO3Q2%fJUO5Q2%fJ4UMJ8	o	oUO%[7U	2]2[OOV]*2o
[)U
QQ	Q
59^tt^2oUO+2oPPP2UO-QW2UO-QU2P!)%fhCK9h)%fhCK&9h)%fhCK�9httoh)%fhKw9h)z'Test heatmap HTML export functionality.rVr�r�r�zother.py�
other_funcr=r\r]r^z<!doctype html>z<htmlzTachyon ProfilerrCrDzline-sampleznav-btn)r(r)r+r,r-rr�r�rnr�rrr5r4r3r4r6r7r��getsizerarbr�lowerrErFrGr`)r�heatmap_dirrb�test_frames1�test_frames2�test_frames3r?rHrc�
file_htmls�file_html_path�file_contents&           r�test_heatmap_collector_export�2TestHeatmapCollector.test_heatmap_collector_export�s����&�&�(������
�
�{�3�$�#�>�	�
 ����M�)�R��$I�=�Yb�df�ho�Kp�#q�r�s�
�
��
 ����M�)�R��$I�=�Yb�df�ho�Kp�#q�r�s�
�
��
 ��N�1�}�Z�QR�T`�7a�6b�$c�#d�e�
��	���,�'����,�'����,�'�����!2�!2����[�)�"3���W�W�\�\�+�|�<�
���������z�2�3����2�7�7�?�?�:�6��:��*�c�G�
4�
4���f�f�h�G�5�	
�
�
�'�����9��
�
�g�w�'��
�
�(�'�2�	
�
�
�i��)��
�
�j�'�*�"$���K�!8�j�!8�A�L�L��<Q�a�VW�V`�V`�ah�Vi�a�a�!8�
�j����3�z�?�A�.������k�a�=�A��
�.�#��
8�
8�A��6�6�8�L�9�	
�
�
�m�\�2��
�
�i��.�A"3�!2�!2������5�
4�
4��k�
9�
8�sf�M�M	�1M�M*�,M>�M>�$M>�N�M
�M
�
	M�M'	�M'	�*M;	�3M;	�N	�N	rI)	rJrKrLrMrNr�r�rOrPrQs@rr�r��s����3�.�8=/�=/rr�c�>`�\sQsQsnQsQsQsQsQsQs	Us
P!)�TestHeatmapCollectorLocation�z-Tests for HeatmapCollector location handling.c�2�[QQ5o[Q]
Q2o[]
]]]2Um[	][]U,2,2,oUO
U2UOQUO2UO]
UOQ*2P!)z/Test HeatmapCollector uses full location tuple.��rVr�r�)	rrnrrsr�r�r�rrY�rrbr�r�s&   r�$test_heatmap_with_full_location_info�ATestHeatmapCollectorLocation.test_heatmap_with_full_location_infos���$�$�?�	��i��V�4��%�b�"�a��4�������E�7�+�,�
�
��	���&�!�	
�
�
�i��!7�!7�8��
�
�b�)�0�0��;�<rc��[QQ5o[Q]Q2oPUm[][	]U,2,2,oUOU2P!)z7Test HeatmapCollector handles None location gracefully.r�rV�~z<native>)rrnrsr�r�r�r�s&   r�test_heatmap_with_none_location�<TestHeatmapCollectorLocation.test_heatmap_with_none_locationsT��$�$�?�	��c�1�j�1���������E�7�+�,�
�
��	���&�!rc	��[O2oUO[OU2[QQ5o[
Q]
Q2o[]
]]]2Um[][]U,2,2,oUOU2[29^tt^2[29^tt^2UOU2PPP2PPP2UO[ O"O%[ O"O'UQ222P!)%fhKf9h)%fhKq9h)z4Test HeatmapCollector export includes location info.r�rVr��processr=)r(r)r+r,r-rrnrrsr�r�r�rrr5r6r4r3r7r4)r�tmp_dirrbr�r�s&    r�&test_heatmap_export_with_location_data�CTestHeatmapCollectorLocation.test_heatmap_export_with_location_data,s����"�"�$������
�
�w�/�$�$�?�	��i��Y�7��%�b�"�a��4�������E�7�+�,�
�
��	���&�!�����!2�!2����W�%�"3����������r�w�w�|�|�G�\�'J�K�L�"3�!2����s0�D5�2D"	�D5�"D2
�+D2
�-D5�5E	�>E	c�n�[QQ5o[][][Q]dQ]ZQ5[Q]2Q]dQ5[Q]Q	PQ5,2,2,oUO	U2UOQUO2UOQUO2UOQUO2P!)
z2Test HeatmapCollector with 4-element frame format.r�rVzapp.py�main)rrzutils.py�helperzlib.pyr�)rr�r�rnr�rrYr�s&  r�#test_heatmap_collector_frame_format�@TestHeatmapCollectorLocation.test_heatmap_collector_frame_formatBs���$�$�?�	�
 ��"��)�(�C���K�)�*�b�(�3�O�)�(�B�	�$�O���	�
�
��	���&�!�	
�
�
�h�	� 6� 6�7��
�
�j�)�"8�"8�9��
�
�h�	� 6� 6�7rrI)rJrKrLrMrNr�r�r�r�rOrPrQs@rr�r�s"����7�=�,"� M�,8�8rr��__main__)rt�
end_lineno�
col_offset�end_col_offset) rNr4r,r(�unittest�collectionsr�pathlibrr�$profiling.sampling.heatmap_collectorrrr�test.supportrr�TestCaser
rTror�r�r�r%rnr�r�r�r�rJr�rIrr�<module>r�s��;�	�
���"���.�*b�c����:�]3�H�-�-�]3�H 6�x�0�0� 6�F19�8�#4�#4�19�hiC��(9�(9�iC�X8�
R6�H�,=�,=�R6�jT,��!2�!2�T,�nf�f�6	[�	[�d�d�\/�8�,�,�\/�~W8�8�#4�#4�W8�t�z���M�M�O�r

Youez - 2016 - github.com/yon3zu
LinuXploit