ó
[³XMc           @   s   d  e  f d „  ƒ  YZ d S(   t   Counterc           B   sY   e  Z d  Z d Z d d	 d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z RS(
   s9  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

    i    c         C   s   | |  _  | |  _ d  S(   N(   t   _countt   maxval(   t   selft   initialValueR   (    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyt   __init__   s    	c         C   sD   |  j  d k	 r1 |  j | |  j  k r1 t d ‚ n |  j | 7_ |  S(   s—   add other to my value and return self

             >>> c = Counter(100)
             >>> c += 333
             >>> c == 433
             True
        s   sorry, counter got too bigN(   R   t   NoneR   t
   ValueError(   R   t   other(    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyt   __iadd__    s    %c         C   s   |  j  | k S(   sû   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   (    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyt   __eq__.   s    c         C   s   |  j  | ƒ S(   sg   inequality operator

             >>> c = Counter()
             >>> c != 10
             True
        (   R
   (   R   R   (    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyt   __ne__<   s    c         C   s   |  j  d ƒ d S(   s{  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
        i   N(   R	   (   R   (    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyt   incrE   s    c         C   s   |  j  S(   s{   return this counter's value

             >>> c = Counter(555)
             >>> c.value() == 555
             True
        (   R   (   R   (    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyt   valueX   s    c         C   s   d S(   s   i will raise an unexpected exception...
        ... *CAUSE THAT'S THE KINDA GUY I AM*
            
              >>> 1/0
        N(    (   R   (    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyt   unexpectedExceptiona   s    N(   t   __name__t
   __module__t   __doc__R   R   R   R	   R
   R   R   R   R   (    (    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyR       s   							N(   t   objectR    (    (    (    sB   /usr/lib/python2.7/dist-packages/twisted/trial/test/mockdoctest.pyt   <module>   s    