| Server IP : 35.80.110.71 / Your IP : 216.73.216.52 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/IPython/testing/__pycache__/ |
Upload File : |
�
}�e� � � � d Z ddlZddlZddlmZmZmZ ddlmZ d� Z G d� de
� Z G d� d e
� Zd
� Z
e� Z e� Zy)a� Experimental code for cleaner support of IPython syntax with unittest.
In IPython up until 0.10, we've used very hacked up nose machinery for running
tests with IPython special syntax, and this has proved to be extremely slow.
This module provides decorators to try a different approach, stemming from a
conversation Brian and I (FP) had about this problem Sept/09.
The goal is to be able to easily write simple functions that can be seen by
unittest as tests, and ultimately for these to support doctests with full
IPython syntax. Nose already offers this based on naming conventions and our
hackish plugins, but we are seeking to move away from nose dependencies if
possible.
This module follows a different approach, based on decorators.
- A decorator called @ipdoctest can mark any function as having a docstring
that should be viewed as a doctest, but after syntax conversion.
Authors
-------
- Fernando Perez <Fernando.Perez@berkeley.edu>
� N)�
DocTestFinder�
DocTestRunner�TestResults)�InteractiveShellc � � | j j � D ��cg c] \ }}|dkD s�t ||� �� c}}S c c}}w )zmCount number of failures in a doctest runner.
Code modeled after the summarize() method in doctest.
r )�_name2ft�valuesr )�runner�f�ts �</usr/lib/python3/dist-packages/IPython/testing/ipunittest.py�count_failuresr / s6 � �
+1�/�/�*@�*@�*B�M�$�!�Q�a�!�e�K��1��M�M��Ms �
>�>c � � e Zd ZdZd� Zd� Zy)�IPython2PythonConverterz�Convert IPython 'syntax' to valid Python.
Eventually this code may grow to be the full IPython syntax conversion
implementation, but for now it only does prompt conversion.c �X � t j d� | _ t j d� | _ t j d� | _ d| _ d| _ t j d| j
z � | _ t j d| j z � | _ y )Nz
In\ \[\d+\]: z\ \ \ \.\.\.+: zOut\[\d+\]: \s*?\n?�>>> �... z(\s*%s)(.*)$) �re�compile�rps1�rps2�rout�pyps1�pyps2�rpyps1�rpyps2)�selfs r
�__init__z IPython2PythonConverter.__init__= su � ��J�J�/�0�� ��J�J�1�2�� ��J�J�5�6�� ���
���
��j�j�/�D�J�J�">�?����j�j�/�D�J�J�">�?��� c � � ddl m} d}d}d}|}| j j ||� }| j j ||� }| j
j ||� }t
j � }g }|j } |j � D ]� }
| j j |
� }|�/|j � \ }}
| ||j |
d� z � �O| j j |
� }|�/|j � \ }}
| ||j |
d� z � �� | |
� �� | d� dj |� S ) z3Convert IPython prompts to python ones in a string.� )�globalipappr r � FT�
)r# r"