@@ -278,8 +278,8 @@ def __init__(self, engine, initial, predicate, allow_transition):
278
278
279
279
# We keep track of the current best example on the shrink_target
280
280
# attribute.
281
- self .shrink_target = None
282
- self .update_shrink_target ( initial )
281
+ self .shrink_target = initial
282
+ self .clear_change_tracking ( )
283
283
self .shrinks = 0
284
284
285
285
# We terminate shrinks that seem to have reached their logical
@@ -447,23 +447,15 @@ def s(n):
447
447
return "s" if n != 1 else ""
448
448
449
449
total_deleted = self .initial_size - len (self .shrink_target .buffer )
450
-
451
- self .debug ("---------------------" )
452
- self .debug ("Shrink pass profiling" )
453
- self .debug ("---------------------" )
454
- self .debug ("" )
455
450
calls = self .engine .call_count - self .initial_calls
451
+
456
452
self .debug (
457
- "Shrinking made a total of %d call%s "
458
- "of which %d shrank. This deleted %d byte%s out of %d."
459
- % (
460
- calls ,
461
- s (calls ),
462
- self .shrinks ,
463
- total_deleted ,
464
- s (total_deleted ),
465
- self .initial_size ,
466
- )
453
+ "---------------------\n "
454
+ "Shrink pass profiling\n "
455
+ "---------------------\n \n "
456
+ f"Shrinking made a total of { calls } call{ s (calls )} of which "
457
+ f"{ self .shrinks } shrank. This deleted { total_deleted } bytes out "
458
+ f"of { self .initial_size } ."
467
459
)
468
460
for useful in [True , False ]:
469
461
self .debug ("" )
@@ -828,22 +820,17 @@ def __changed_blocks(self):
828
820
829
821
def update_shrink_target (self , new_target ):
830
822
assert isinstance (new_target , ConjectureResult )
831
- if self .shrink_target is not None :
832
- self .shrinks += 1
833
- # If we are just taking a long time to shrink we don't want to
834
- # trigger this heuristic, so whenever we shrink successfully
835
- # we give ourselves a bit of breathing room to make sure we
836
- # would find a shrink that took that long to find the next time.
837
- # The case where we're taking a long time but making steady
838
- # progress is handled by `finish_shrinking_deadline` in engine.py
839
- self .max_stall = max (
840
- self .max_stall , (self .calls - self .calls_at_last_shrink ) * 2
841
- )
842
- self .calls_at_last_shrink = self .calls
843
- else :
844
- self .__all_changed_blocks = set ()
845
- self .__last_checked_changed_at = new_target
846
-
823
+ self .shrinks += 1
824
+ # If we are just taking a long time to shrink we don't want to
825
+ # trigger this heuristic, so whenever we shrink successfully
826
+ # we give ourselves a bit of breathing room to make sure we
827
+ # would find a shrink that took that long to find the next time.
828
+ # The case where we're taking a long time but making steady
829
+ # progress is handled by `finish_shrinking_deadline` in engine.py
830
+ self .max_stall = max (
831
+ self .max_stall , (self .calls - self .calls_at_last_shrink ) * 2
832
+ )
833
+ self .calls_at_last_shrink = self .calls
847
834
self .shrink_target = new_target
848
835
self .__derived_values = {}
849
836
0 commit comments