@@ -269,7 +269,15 @@ def codemod(path):
269
269
multiple = True ,
270
270
help = "dotted name of exception(s) to ignore" ,
271
271
)
272
- def write (func , writer , except_ , style ): # noqa: D301 # \b disables autowrap
272
+ @click .option (
273
+ "--annotate/--no-annotate" ,
274
+ default = None ,
275
+ help = "force ghostwritten tests to be type-annotated (or not). "
276
+ "By default, match the code to test." ,
277
+ )
278
+ def write (
279
+ func , writer , except_ , style , annotate
280
+ ): # noqa: D301 # \b disables autowrap
273
281
"""`hypothesis write` writes property-based tests for you!
274
282
275
283
Type annotations are helpful but not required for our advanced introspection
@@ -278,6 +286,7 @@ def write(func, writer, except_, style): # noqa: D301 # \b disables autowrap
278
286
\b
279
287
hypothesis write gzip
280
288
hypothesis write numpy.matmul
289
+ hypothesis write pandas.from_dummies
281
290
hypothesis write re.compile --except re.error
282
291
hypothesis write --equivalent ast.literal_eval eval
283
292
hypothesis write --roundtrip json.dumps json.loads
@@ -287,7 +296,7 @@ def write(func, writer, except_, style): # noqa: D301 # \b disables autowrap
287
296
# NOTE: if you want to call this function from Python, look instead at the
288
297
# ``hypothesis.extra.ghostwriter`` module. Click-decorated functions have
289
298
# a different calling convention, and raise SystemExit instead of returning.
290
- kwargs = {"except_" : except_ or (), "style" : style }
299
+ kwargs = {"except_" : except_ or (), "style" : style , "annotate" : annotate }
291
300
if writer is None :
292
301
writer = "magic"
293
302
elif writer == "idempotent" and len (func ) > 1 :
0 commit comments