File tree 1 file changed +6
-0
lines changed
hypothesis-python/src/hypothesis/internal/conjecture 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 13
13
from hypothesis .internal .compat import int_from_bytes , int_to_bytes
14
14
from hypothesis .internal .conjecture .data import (
15
15
ConjectureResult ,
16
+ IRType ,
16
17
Status ,
17
18
_Overrun ,
18
19
bits_to_bytes ,
@@ -134,12 +135,16 @@ def attempt_replace(k: int) -> bool:
134
135
return False
135
136
136
137
node = self .current_data .examples .ir_tree_nodes [i ]
138
+ assert node .index is not None
137
139
if node .was_forced :
138
140
return False # pragma: no cover
139
141
142
+ new_value : IRType
140
143
if node .ir_type in {"integer" , "float" }:
144
+ assert isinstance (node .value , (int , float ))
141
145
new_value = node .value + k
142
146
elif node .ir_type == "boolean" :
147
+ assert isinstance (node .value , bool )
143
148
if abs (k ) > 1 :
144
149
return False
145
150
if k == - 1 :
@@ -150,6 +155,7 @@ def attempt_replace(k: int) -> bool:
150
155
new_value = node .value
151
156
else :
152
157
assert node .ir_type == "bytes"
158
+ assert isinstance (node .value , bytes )
153
159
v = int_from_bytes (node .value )
154
160
# can't go below zero for bytes
155
161
if v + k < 0 :
You can’t perform that action at this time.
0 commit comments