File manager - Edit - /usr/lib/python3/dist-packages/twisted/trial/test/__pycache__/mockdoctest.cpython-310.pyc
Back
o �bu � @ s G d d� d�Z dS )c @ sb e Zd ZdZdZddd�Zdd� Zded efd d�Z ded efdd �Z dd� Zdd� Zdd� Z dS )�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 C s || _ || _d S )N)�_count�maxval)�self�initialValuer � r �@/usr/lib/python3/dist-packages/twisted/trial/test/mockdoctest.py�__init__ s zCounter.__init__c C s4 | j dur| j| | j krtd��| 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)r r � ValueError�r �otherr r r �__iadd__! s zCounter.__iadd__r �returnc C s | 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 �r r r r r �__eq__/ s zCounter.__eq__c C s | � |� S )zXinequality operator >>> c = Counter() >>> c != 10 True )r r r r r �__ne__= s zCounter.__ne__c C s | � 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 �r r r r �incrF s zCounter.incrc C s | j S )zlreturn this counter's value >>> c = Counter(555) >>> c.value() == 555 True r r r r r �valueY s z Counter.valuec C s dS )zui will raise an unexpected exception... ... *CAUSE THAT'S THE KINDA GUY I AM* >>> 1/0 Nr r r r r �unexpectedExceptionb s zCounter.unexpectedException)r N)�__name__� __module__�__qualname__�__doc__r r r �object�boolr r r r r r r r r r s r N)r r r r r �<module> s
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings