Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(16)  |  Call(14)  |  Derive(0)  |  Import(2)

        def track_call(func):
    return CallLogger(func)
        


src/a/s/astm-0.5.0/astm/tests/test_protocol.py   astm(Download)
import unittest
from astm import constants
from astm.tests.utils import DummyMixIn, track_call
from astm import protocol
 
    def test_found_terminator(self):
        obj = DummyProto()
        obj.dispatch = track_call(obj.dispatch)
        obj.found_terminator()
        self.assertTrue(not obj.dispatch.was_called)
    def test_found_terminator_skip_empty(self):
        obj = DummyProto()
        obj.dispatch = track_call(obj.dispatch)
        obj.inbox.append('')
        obj.inbox.append(None)
    def test_on_enq(self):
        obj = DummyProto()
        obj.on_enq = track_call(obj.on_enq)
        obj.dispatch(constants.ENQ)
        self.assertTrue(obj.on_enq.was_called)
 
    def test_on_ack(self):
        obj = DummyProto()
        obj.on_ack = track_call(obj.on_ack)

src/a/s/astm-0.5.0/astm/tests/test_server.py   astm(Download)
from astm.server import RequestHandler, BaseRecordsDispatcher
from astm import codec, constants, records
from astm.tests.utils import DummyMixIn, track_call
 
def null_dispatcher(*args, **kwargs):
    def setUp(self):
        self.req = DummyRequestHandler()
        self.req.dispatcher = track_call(self.req.dispatcher)
        self.stderr = sys.stderr
        sys.stderr = open(os.devnull, 'w')
    def test_reject_message_on_dispatch_error(self):
        def dispatcher(message):
            codec.decode_message(message, 'latin-1')
        req = DummyRequestHandler(track_call(dispatcher))
        req.on_enq()
    def test_close_on_timeout(self):
        self.req.close = track_call(self.req.close)
        self.req.on_timeout()
        self.assertTrue(self.req.close.was_called)
 
    def setUp(self):
        d = BaseRecordsDispatcher()
        for key, value in d.dispatch.items():
            d.dispatch[key] = track_call(value)
        d.on_unknown = track_call(d.on_unknown)