Пример #1
0
 def testDescription(self):
   """Tests the description of the Deferred objects from the semaphore."""
   d = [self.queue.acquire(i * 2) for i in range(5)]
   self.assertEqual(
       '*DeferredPrioritySemaphore(@%x, #1/5, priority=0, waiting=2)' % id(d[0]),
       base.describeDeferred(d[0]).partition(' ')[2]) # split off the active time
   self.assertEqual(
       'DeferredPrioritySemaphore(@%x, #5/5, priority=8, waiting=2)' % id(d[4]),
       base.describeDeferred(d[4]).partition(' ')[2]) # split off the active time
Пример #2
0
 def describeDeferred(self):
   """Describes this Deferred."""
   generatorName = self._generator.__name__
   if self._className is not None:
     generatorName = self._className + '.' + generatorName
   if self._reprFn:
     return '%s (%s):%s -> %s' % (generatorName, self._reprFn(), self._state,
                                  base.describeDeferred(self._current))
   else:
     return '%s:%s -> %s' % (generatorName, self._state, base.describeDeferred(self._current))
Пример #3
0
 def describeDeferred(self):
     """Describes this Deferred."""
     generatorName = self._generator.__name__
     if self._className is not None:
         generatorName = self._className + '.' + generatorName
     if self._reprFn:
         return '%s (%s):%s -> %s' % (generatorName, self._reprFn(),
                                      self._state,
                                      base.describeDeferred(self._current))
     else:
         return '%s:%s -> %s' % (generatorName, self._state,
                                 base.describeDeferred(self._current))
Пример #4
0
 def testDescription(self):
     """Tests the description of the Deferred objects from the semaphore."""
     d = [self.queue.acquire(i * 2) for i in range(5)]
     self.assertEqual(
         '*DeferredPrioritySemaphore(@%x, #1/5, priority=0, waiting=2)' %
         id(d[0]),
         base.describeDeferred(
             d[0]).partition(' ')[2])  # split off the active time
     self.assertEqual(
         'DeferredPrioritySemaphore(@%x, #5/5, priority=8, waiting=2)' %
         id(d[4]),
         base.describeDeferred(
             d[4]).partition(' ')[2])  # split off the active time
Пример #5
0
 def describeDeferred(self):
   """Describes this Deferred."""
   return '%s:%s -> %s' % (self._generator.__name__, self._state, base.describeDeferred(self._current))
Пример #6
0
 def describeDeferred(self):
     """Describes this Deferred."""
     return "%s:%s -> %s" % (self._generator.__name__, self._state, base.describeDeferred(self._current))