o
    g7	                     @   sl   d Z ddlZddlZddlmZ ejjdkredG dd deZ	dd	 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)support   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   H/Users/admin/.pyenv/versions/3.10.0/lib/python3.10/test/test_doctest2.py__init__"       z
C.__init__c                 C   r   )z/
        >>> print(C()) # 4
        42
        Z42Nr   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	   nested7   r   z
C.D.nestedN)__name__
__module____qualname____doc__r   r   r   r   r	   D0   s    r   c                 C   s   | j  S )zg
        >>> c = C()    # 7
        >>> c.x = 12   # 8
        >>> print(c.x)  # 9
        -12
        N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	   setxF   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  Nr   r   r   r   r	   statmV      
zC.statmc                 C   s   |S )z
        A class method.

        >>> print(C.clsm(22))    # 18
        22
        >>> print(C().clsm(23))  # 19
        23
        Nr   )clsvalr   r   r	   clsmb   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                  C   s<   ddl m}  d}t| \}}||krtd||f d S )Nr   )test_doctest2   z expected %d tests to run, not %d)testr"   r   Zrun_doctestZ
TestFailed)r"   ZEXPECTEDftr   r   r	   	test_mainn   s   r'   )*__main__)r   sysZunittestr$   r   flagsoptimizeZSkipTestr   r   r'   doctestr   r   r   r   r	   <module>   s    
Z

