o
    HXho	                     @   sl   d Z ddlZddlZejjdkredG dd deZG dd dejZ	dd	l
T ed
kr4e  dS dS )u   A module to test whether doctest recognizes some 2.2 features,
like static and class methods.

>>> print('yup')  # 1
yup

We include some (random) encoded (utf-8) text in the text surrounding
the example.  It should be ignored:

ЉЊЈЁЂ

    N   zCannot test docstrings with -O2c                   @   sf   e Zd ZdZdd Zdd ZG dd deZdd	 Zd
d Z	e
ee	ddZedd Zedd ZdS )Cu   Class C.

    >>> print(C())  # 2
    42


    We include some (random) encoded (utf-8) text in the text surrounding
    the example.  It should be ignored:

        ЉЊЈЁЂ

    c                 C      dS )z;C.__init__.

        >>> print(C()) # 3
        42
        N selfr   r   </opt/python-3.10.19/usr/lib/python3.10/test/test_doctest2.py__init__!       z
C.__init__c                 C   r   )z/
        >>> print(C()) # 4
        42
        Z42r   r   r   r   r   __str__(   s   z	C.__str__c                   @   s   e Zd ZdZdd ZdS )zC.DzJA nested D class.

        >>> print("In D!")   # 5
        In D!
        c                 C   r   )z8
            >>> print(3) # 6
            3
            Nr   r   r   r   r   nested6   r
   z
C.D.nestedN)__name__
__module____qualname____doc__r   r   r   r   r   D/   s    r   c                 C   s   | j  S )zg
        >>> c = C()    # 7
        >>> c.x = 12   # 8
        >>> print(c.x)  # 9
        -12
        Z_xr   r   r   r   getx<   s   zC.getxc                 C   s
   || _ dS )zm
        >>> c = C()     # 10
        >>> c.x = 12    # 11
        >>> print(c.x)   # 12
        -12
        Nr   )r   valuer   r   r   setxE   s   
zC.setxzi        >>> c = C()    # 13
        >>> c.x = 12   # 14
        >>> print(c.x)  # 15
        -12
        )docc                   C   r   )z
        A static method.

        >>> print(C.statm())    # 16
        666
        >>> print(C().statm())  # 17
        666
        i  r   r   r   r   r   statmU      
zC.statmc                 C   s   |S )z
        A class method.

        >>> print(C.clsm(22))    # 18
        22
        >>> print(C().clsm(23))  # 19
        23
        r   )clsvalr   r   r   clsma   r   zC.clsmN)r   r   r   r   r	   r   objectr   r   r   propertyxstaticmethodr   classmethodr   r   r   r   r   r      s    		
r   c                   @   s   e Zd Zdd ZdS )Testc                 C   s`   dd l }dd l}d}||jt \}}|r| d||f  ||kr.| d||f  d S d S )Nr      z%d of %d doctests failedz expected %d tests to run, not %d)doctestsystestmodmodulesr   Zfail)r   r#   r$   ZEXPECTEDftr   r   r   test_testmodo   s   zTest.test_testmodN)r   r   r   r)   r   r   r   r   r!   n   s    r!   )*__main__)r   r$   ZunittestflagsoptimizeZSkipTestr   r   ZTestCaser!   r#   r   mainr   r   r   r   <module>   s    
[