Beispiel #1
0
 def do_draw(self, data):
     count = 0
     while True:
         try:
             with self.limited_base.capped(self.max_leaves):
                 return data.draw(self.strategy)
         except LimitReached:
             if count == 0:
                 data.note_event(deferredformat(
                     'Draw for %r exceeded max_leaves '
                     'and had to be retried', self,))
             count += 1
 def do_draw(self, data):
     count = 0
     while True:
         try:
             with self.limited_base.capped(self.max_leaves):
                 return data.draw(self.strategy)
         except LimitReached:
             if count == 0:
                 data.note_event(deferredformat(
                     'Draw for %r exceeded max_leaves '
                     'and had to be retried', self,))
             count += 1
 def do_draw(self, data):
     for i in hrange(3):
         start_index = data.index
         value = data.draw(self.filtered_strategy)
         if self.condition(value):
             return value
         else:
             if i == 0:
                 data.note_event(deferredformat(
                     'Retried draw from %r to satisfy filter', self,))
             # This is to guard against the case where we consume no data.
             # As long as we consume data, we'll eventually pass or raise.
             # But if we don't this could be an infinite loop.
             assume(data.index > start_index)
     data.note_event('Aborted test because unable to satisfy %r' % (
         self,
     ))
     data.mark_invalid()
Beispiel #4
0
 def do_draw(self, data):
     for i in hrange(3):
         start_index = data.index
         value = data.draw(self.filtered_strategy)
         if self.condition(value):
             return value
         else:
             if i == 0:
                 data.note_event(deferredformat(
                     'Retried draw from %r to satisfy filter', self,))
             # This is to guard against the case where we consume no data.
             # As long as we consume data, we'll eventually pass or raise.
             # But if we don't this could be an infinite loop.
             assume(data.index > start_index)
     data.note_event('Aborted test because unable to satisfy %r' % (
         self,
     ))
     data.mark_invalid()