def test_generator_wrap(self): g = IdGenerator() g._next = 2 ** 53 - 1 # cheat a little v = next(g) self.assertEqual(v, 2 ** 53) v = next(g) self.assertEqual(v, 1)
def test_generator_wrap(self): g = IdGenerator() g._next = 2**53 - 1 # cheat a little v = next(g) self.assertEqual(v, 2**53) v = next(g) self.assertEqual(v, 1)
def __init__(self): """ """ ObservableMixin.__init__(self) # this is for library level debugging self.debug = False # this is for app level debugging. exceptions raised in user code # will get logged (that is, when invoking remoted procedures or # when invoking event handlers) self.debug_app = False # this is for marshalling traceback from exceptions thrown in user # code within WAMP error messages (that is, when invoking remoted # procedures) self.traceback_app = False # mapping of exception classes to WAMP error URIs self._ecls_to_uri_pat = {} # mapping of WAMP error URIs to exception classes self._uri_to_ecls = { ApplicationError.INVALID_PAYLOAD: SerializationError } # session authentication information self._authid = None self._authrole = None self._authmethod = None self._authprovider = None # generator for WAMP request IDs self._request_id_gen = IdGenerator()
def test_idgenerator_is_generator(self): "IdGenerator follows the generator protocol" g = IdGenerator() self.assertEqual(1, next(g)) self.assertEqual(2, next(g))