Skip to content

Commit fc9c009

Browse files
committed
use ir_tree_to_data to avoid going through full flow
1 parent 075a46b commit fc9c009

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

hypothesis-python/src/hypothesis/internal/conjecture/engine.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ def __stoppable_test_function(self, data):
239239
# correct engine.
240240
raise
241241

242+
def ir_tree_to_data(self, ir_tree_nodes):
243+
data = ConjectureData.for_ir_tree(ir_tree_nodes)
244+
self.__stoppable_test_function(data)
245+
return data
246+
242247
def test_function(self, data):
243248
if self.__pending_call_explanation is not None:
244249
self.debug(self.__pending_call_explanation)
@@ -316,8 +321,7 @@ def test_function(self, data):
316321

317322
# drive the ir tree through the test function to convert it
318323
# to a buffer
319-
data = ConjectureData.for_ir_tree(data.examples.ir_tree_nodes)
320-
self.__stoppable_test_function(data)
324+
data = self.ir_tree_to_data(data.examples.ir_tree_nodes)
321325
self.__data_cache[data.buffer] = data.as_result()
322326

323327
key = data.interesting_origin

hypothesis-python/src/hypothesis/internal/conjecture/shrinker.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ def calls(self):
376376
return self.engine.call_count
377377

378378
def consider_new_tree(self, tree):
379-
data = ConjectureData.for_ir_tree(tree)
380-
self.engine.test_function(data)
379+
data = self.engine.ir_tree_to_data(tree)
381380

382381
return self.consider_new_buffer(data.buffer)
383382

0 commit comments

Comments
 (0)