U
    ª€lj]  ã                   @   s*   d Z ddlmZmZ G dd„ dejƒZdS )z
Receivers for use in tests.
é    )ÚbaseÚipositioningc                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚMockPositioningReceivera  
    A mock positioning receiver.

    Mocks all the L{IPositioningReceiver} methods with stubs that don't do
    anything but register that they were called.

    @ivar called: A mapping of names of callbacks that have been called to
        C{True}.
    @type called: C{dict}
    c                 C   s"   |   ¡  tjD ]}|  |¡ qd S )N)Úclearr   ZIPositioningReceiverÚ_addCallback)ÚselfÚ
methodName© r	   úE/tmp/pip-unpacked-wheel-aghyhbke/twisted/positioning/test/receiver.pyÚ__init__   s    
z MockPositioningReceiver.__init__c                 C   s
   i | _ dS )zt
        Forget all the methods that have been called on this receiver, by
        emptying C{self.called}.
        N©Úcalled)r   r	   r	   r
   r      s    zMockPositioningReceiver.clearc                    s   ‡ ‡fdd„}t ˆˆ |ƒ dS )zq
        Adds a callback of the given name, setting C{self.called[name]} to
        C{True} when called.
        c                     s   dˆj ˆ < d S )NTr   )ÚaÚkw©Únamer   r	   r
   Úcallback*   s    z6MockPositioningReceiver._addCallback.<locals>.callbackN)Úsetattr)r   r   r   r	   r   r
   r   $   s    z$MockPositioningReceiver._addCallbackN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r	   r	   r	   r
   r      s   r   N)r   Ztwisted.positioningr   r   ZBasePositioningReceiverr   r	   r	   r	   r
   Ú<module>   s   