B
    u9a7	                 @   sh   d Z ddlZddlZddlmZ ejjdkr6edG dd deZ	dd	 Z
dd
lT edkrde
  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   s   dS )z;C.__init__.

        >>> print(C()) # 3
        42
        N )selfr   r   #/usr/lib/python3.7/test_doctest2.py__init__"   s    z
C.__init__c             C   s   dS )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   s   dS )z8
            >>> print(3) # 6
            3
            Nr   )r   r   r   r   nested7   s    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
        )_x)r   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
        N)r   )r   valuer   r   r   setxF   s    zC.setxzi        >>> c = C()    # 13
        >>> c.x = 12   # 14
        >>> print(c.x)  # 15
        -12
        )docc               C   s   dS )z
        A static method.

        >>> print(C.statm())    # 16
        666
        >>> print(C().statm())  # 17
        666
        i  r   r   r   r   r   statmV   s    
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   clsmb   s    
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r8t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#   Zdoctestr   r   r   r   r   <module>   s   
Z
