%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Receivers for use in tests.
"""
from __future__ import absolute_import, division
from twisted.positioning import base, ipositioning
class MockPositioningReceiver(base.BasePositioningReceiver):
"""
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}
"""
def __init__(self):
self.clear()
for methodName in ipositioning.IPositioningReceiver:
self._addCallback(methodName)
def clear(self):
"""
Forget all the methods that have been called on this receiver, by
emptying C{self.called}.
"""
self.called = {}
def _addCallback(self, name):
"""
Adds a callback of the given name, setting C{self.called[name]} to
C{True} when called.
"""
def callback(*a, **kw):
self.called[name] = True
setattr(self, name, callback)