HOME


Mini Shell 1.0
DIR: /usr/lib/python3/dist-packages/twisted/trial/test/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/twisted/trial/test/__pycache__/mockdoctest.cpython-312.pyc
�

Ϫ�fu	���Gd�d�Zy)c�T�eZdZdZdZd
d�Zd�Zdedefd�Z	dedefd	�Z
d
�Zd�Zd�Z
y)�Counterz�a simple counter object for testing trial's doctest support

    >>> c = Counter()
    >>> c.value()
    0
    >>> c += 3
    >>> c.value()
    3
    >>> c.incr()
    >>> c.value() == 4
    True
    >>> c == 4
    True
    >>> c != 9
    True

    �Nc� �||_||_y)N)�_count�maxval)�self�initialValuers   �@/usr/lib/python3/dist-packages/twisted/trial/test/mockdoctest.py�__init__zCounter.__init__s��"������c��|j�'|j|z|jkDrtd��|xj|z
c_|S)z�add other to my value and return self

        >>> c = Counter(100)
        >>> c += 333
        >>> c == 433
        True
        zsorry, counter got too big)rr�
ValueError�r�others  r
�__iadd__zCounter.__iadd__!sA���;�;�"����u�)<����(K��9�:�:��K�K�5� �K��rr�returnc� �|j|k(S)z�equality operator, compare other to my value()

        >>> c = Counter()
        >>> c == 0
        True
        >>> c += 10
        >>> c.incr()
        >>> c == 10   # fail this test on purpose
        True

        �rrs  r
�__eq__zCounter.__eq__/s���{�{�e�#�#rc�&�|j|�S)zXinequality operator

        >>> c = Counter()
        >>> c != 10
        True
        )rrs  r
�__ne__zCounter.__ne__=s���;�;�u�%�%�%rc�&�|jd�y)a:increment my value by 1

        >>> from twisted.trial.test.mockdoctest import Counter
        >>> c = Counter(10, 11)
        >>> c.incr()
        >>> c.value() == 11
        True
        >>> c.incr()
        Traceback (most recent call last):
          File "<stdin>", line 1, in ?
          File "twisted/trial/test/mockdoctest.py", line 51, in incr
            self.__iadd__(1)
          File "twisted/trial/test/mockdoctest.py", line 39, in __iadd__
            raise ValueError, "sorry, counter got too big"
        ValueError: sorry, counter got too big
        �N)r�rs r
�incrzCounter.incrFs��"	
�
�
�a�rc��|jS)zlreturn this counter's value

        >>> c = Counter(555)
        >>> c.value() == 555
        True
        rrs r
�valuez
Counter.valueYs���{�{�rc��y)zui will raise an unexpected exception...
        ... *CAUSE THAT'S THE KINDA GUY I AM*

              >>> 1/0
        N�rs r
�unexpectedExceptionzCounter.unexpectedExceptionbs�r)rN)�__name__�
__module__�__qualname__�__doc__rrr�object�boolrrrrr rrr
rrsM���$�F���$�F�$�t�$�&�F�&�t�&��&�rrN)rrrr
�<module>r's��_�_r