HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/twisted/trial/test/__pycache__/mockdoctest.cpython-38.pyc
U


W[U
�@s$ddlmZmZGdd�de�ZdS)�)�division�absolute_importc@sNeZdZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�Countera9a 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

    rNcCs||_||_dS)N)�_count�maxval)�selfZinitialValuer�r�@/usr/lib/python3/dist-packages/twisted/trial/test/mockdoctest.py�__init__szCounter.__init__cCs6|jdk	r$|j||jkr$td��n|j|7_|S)z�add other to my value and return self

             >>> c = Counter(100)
             >>> c += 333
             >>> c == 433
             True
        Nzsorry, counter got too big)rr�
ValueError�r�otherrrr	�__iadd__ s
zCounter.__iadd__cCs
|j|kS)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

        �rrrrr	�__eq__.szCounter.__eq__cCs|�|�S)zginequality operator

             >>> c = Counter()
             >>> c != 10
             True
        )rrrrr	�__ne__<szCounter.__ne__cCs|�d�dS)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�rrrr	�incrEszCounter.incrcCs|jS)z{return this counter's value

             >>> c = Counter(555)
             >>> c.value() == 555
             True
        rrrrr	�valueXsz
Counter.valuecCsdS)zui will raise an unexpected exception...
        ... *CAUSE THAT'S THE KINDA GUY I AM*

              >>> 1/0
        Nrrrrr	�unexpectedExceptionaszCounter.unexpectedException)rN)�__name__�
__module__�__qualname__�__doc__rr
rrrrrrrrrr	rs
		rN)Z
__future__rr�objectrrrrr	�<module>s