/
changes.rst
14385 lines (10172 loc) · 445 KB
/
changes.rst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
=========
Changelog
=========
This is a record of all past Hypothesis releases and what went into them,
in reverse chronological order. All previous releases should still be available
:pypi:`on PyPI <hypothesis>`.
Hypothesis 6.x
==============
.. only:: has_release_file
--------------------
Current pull request
--------------------
.. include:: ../RELEASE.rst
.. _v6.100.1:
--------------------
6.100.1 - 2024-04-08
--------------------
This patch improve a rare error message for flaky tests (:issue:`3940`).
.. _v6.100.0:
--------------------
6.100.0 - 2024-03-31
--------------------
The :func:`~hypothesis.extra.numpy.from_dtype` function no longer generates
``NaT`` ("not-a-time") values for the ``datetime64`` or ``timedelta64`` dtypes
if passed ``allow_nan=False`` (:issue:`3943`).
.. _v6.99.13:
--------------------
6.99.13 - 2024-03-24
--------------------
This patch includes the :obj:`~hypothesis.settings.backend` setting in the
``how_generated`` field of our :doc:`observability output <observability>`.
.. _v6.99.12:
--------------------
6.99.12 - 2024-03-23
--------------------
If you were running Python 3.13 (currently in alpha) with :pypi:`pytest-xdist`
and then attempted to pretty-print a ``lambda`` functions which was created
using the :func:`eval` builtin, it would have raised an AssertionError.
Now you'll get ``"lambda ...: <unknown>"``, as expected.
.. _v6.99.11:
--------------------
6.99.11 - 2024-03-20
--------------------
This release improves an internal invariant.
.. _v6.99.10:
--------------------
6.99.10 - 2024-03-20
--------------------
This patch fixes Hypothesis sometimes raising a ``Flaky`` error when generating collections of unique floats containing ``nan``. See :issue:`3926` for more details.
.. _v6.99.9:
-------------------
6.99.9 - 2024-03-19
-------------------
This patch continues our work on refactoring the shrinker (:issue:`3921`).
.. _v6.99.8:
-------------------
6.99.8 - 2024-03-18
-------------------
This patch continues our work on refactoring shrinker internals (:issue:`3921`).
.. _v6.99.7:
-------------------
6.99.7 - 2024-03-18
-------------------
This release resolves :py:exc:`PermissionError` that come from
creating databases on inaccessible paths.
.. _v6.99.6:
-------------------
6.99.6 - 2024-03-14
-------------------
This patch starts work on refactoring our shrinker internals. There is no user-visible change.
.. _v6.99.5:
-------------------
6.99.5 - 2024-03-12
-------------------
This patch fixes a longstanding performance problem in stateful testing (:issue:`3618`),
where state machines which generated a substantial amount of input for each step would
hit the maximum amount of entropy and then fail with an ``Unsatisfiable`` error.
We now stop taking additional steps when we're approaching the entropy limit,
which neatly resolves the problem without touching unaffected tests.
.. _v6.99.4:
-------------------
6.99.4 - 2024-03-11
-------------------
Fix regression caused by using :pep:`696` default in TypeVar with Python 3.13.0a3.
.. _v6.99.3:
-------------------
6.99.3 - 2024-03-11
-------------------
This patch further improves the type annotations in :mod:`hypothesis.extra.numpy`.
.. _v6.99.2:
-------------------
6.99.2 - 2024-03-10
-------------------
Simplify the type annotation of :func:`~hypothesis.extra.pandas.column` and
:func:`~hypothesis.extra.pandas.columns` by using :pep:`696` to avoid overloading.
.. _v6.99.1:
-------------------
6.99.1 - 2024-03-10
-------------------
This patch implements type annotations for :func:`~hypothesis.extra.pandas.column`.
.. _v6.99.0:
-------------------
6.99.0 - 2024-03-09
-------------------
This release adds the **experimental and unstable** :obj:`~hypothesis.settings.backend`
setting. See :ref:`alternative-backends` for details.
.. _v6.98.18:
--------------------
6.98.18 - 2024-03-09
--------------------
This patch fixes :issue:`3900`, a performance regression for
:func:`~hypothesis.extra.numpy.arrays` due to the interaction of
:ref:`v6.98.12` and :ref:`v6.97.1`.
.. _v6.98.17:
--------------------
6.98.17 - 2024-03-04
--------------------
This patch improves the type annotations in :mod:`hypothesis.extra.numpy`,
which makes inferred types more precise for both :pypi:`mypy` and
:pypi:`pyright`, and fixes some strict-mode errors on the latter.
Thanks to Jonathan Plasse for reporting and fixing this in :pull:`3889`!
.. _v6.98.16:
--------------------
6.98.16 - 2024-03-04
--------------------
This patch paves the way for future shrinker improvements. There is no user-visible change.
.. _v6.98.15:
--------------------
6.98.15 - 2024-02-29
--------------------
This release adds support for the Array API's `2023.12 release
<https://data-apis.org/array-api/2023.12/>`_ via the ``api_version`` argument in
:func:`~hypothesis.extra.array_api.make_strategies_namespace`. The API additions
and modifications in the ``2023.12`` spec do not necessitate any changes in the
Hypothesis strategies, hence there is no distinction between a ``2022.12`` and
``2023.12`` strategies namespace.
.. _v6.98.14:
--------------------
6.98.14 - 2024-02-29
--------------------
This patch adjusts the printing of bundle values to correspond
with their names when using stateful testing.
.. _v6.98.13:
--------------------
6.98.13 - 2024-02-27
--------------------
This patch implements filter-rewriting for :func:`~hypothesis.strategies.text`
and :func:`~hypothesis.strategies.binary` with the :meth:`~re.Pattern.search`,
:meth:`~re.Pattern.match`, or :meth:`~re.Pattern.fullmatch` method of a
:func:`re.compile`\ d regex.
.. _v6.98.12:
--------------------
6.98.12 - 2024-02-25
--------------------
This patch implements filter-rewriting for most length filters on some
additional collection types (:issue:`3795`), and fixes several latent
bugs where unsatisfiable or partially-infeasible rewrites could trigger
internal errors.
.. _v6.98.11:
--------------------
6.98.11 - 2024-02-24
--------------------
This patch makes stateful testing somewhat less likely to get stuck
when there are only a few possible rules.
.. _v6.98.10:
--------------------
6.98.10 - 2024-02-22
--------------------
This patch :pep:`adds a note <678>` to errors which occur while drawing from
a strategy, to make it easier to tell why your test failed in such cases.
.. _v6.98.9:
-------------------
6.98.9 - 2024-02-20
-------------------
This patch ensures that :doc:`observability <observability>` outputs include
an informative repr for :class:`~hypothesis.stateful.RuleBasedStateMachine`
stateful tests, along with more detailed timing information.
.. _v6.98.8:
-------------------
6.98.8 - 2024-02-18
-------------------
This patch improves :doc:`the Ghostwriter <ghostwriter>` for binary operators.
.. _v6.98.7:
-------------------
6.98.7 - 2024-02-18
-------------------
This patch improves import-detection in :doc:`the Ghostwriter <ghostwriter>`
(:issue:`3884`), particularly for :func:`~hypothesis.strategies.from_type`
and strategies from ``hypothesis.extra.*``.
.. _v6.98.6:
-------------------
6.98.6 - 2024-02-15
-------------------
This patch clarifies the documentation on stateful testing (:issue:`3511`).
.. _v6.98.5:
-------------------
6.98.5 - 2024-02-14
-------------------
This patch improves argument-to-json conversion for :doc:`observability <observability>`
output. Checking for a ``.to_json()`` method on the object *before* a few other
options like dataclass support allows better user control of the process (:issue:`3880`).
.. _v6.98.4:
-------------------
6.98.4 - 2024-02-12
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
.. _v6.98.3:
-------------------
6.98.3 - 2024-02-08
-------------------
This patch fixes an error when generating :doc:`observability <observability>` reports involving large (``n > 1e308``) integers.
.. _v6.98.2:
-------------------
6.98.2 - 2024-02-05
-------------------
This patch refactors some internals. There is no user-visible change.
.. _v6.98.1:
-------------------
6.98.1 - 2024-02-05
-------------------
This release improves our distribution of generated values for all strategies, by doing a better job of tracking which values we have generated before and avoiding generating them again.
For example, ``st.lists(st.integers())`` previously generated ~5 each of ``[]`` ``[0]`` in 100 examples. In this release, each of ``[]`` and ``[0]`` are generated ~1-2 times each.
.. _v6.98.0:
-------------------
6.98.0 - 2024-02-05
-------------------
This release deprecates use of the global random number generator while drawing
from a strategy, because this makes test cases less diverse and prevents us
from reporting minimal counterexamples (:issue:`3810`).
If you see this new warning, you can get a quick fix by using
:func:`~hypothesis.strategies.randoms`; or use more idiomatic strategies
:func:`~hypothesis.strategies.sampled_from`, :func:`~hypothesis.strategies.floats`,
:func:`~hypothesis.strategies.integers`, and so on.
Note that the same problem applies to e.g. ``numpy.random``, but
for performance reasons we only check the stdlib :mod:`random` module -
ignoring even other sources passed to :func:`~hypothesis.register_random`.
.. _v6.97.6:
-------------------
6.97.6 - 2024-02-04
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
.. _v6.97.5:
-------------------
6.97.5 - 2024-02-03
-------------------
This patch adds some :doc:`observability information <observability>`
about how many times predicates in :func:`~hypothesis.assume` or
:func:`~hypothesis.stateful.precondition` were satisfied, so that
downstream tools can warn you if some were *never* satisfied by
any test case.
.. _v6.97.4:
-------------------
6.97.4 - 2024-01-31
-------------------
This patch improves formatting and adds some cross-references to our docs.
.. _v6.97.3:
-------------------
6.97.3 - 2024-01-30
-------------------
Internal test refactoring.
.. _v6.97.2:
-------------------
6.97.2 - 2024-01-30
-------------------
This patch slightly changes how we replay examples from
:doc:`the database <database>`: if the behavior of the saved example has
changed, we now keep running the test case instead of aborting at the size
of the saved example. While we know it's not the *same* example, we might
as well continue running the test!
Because we now finish running a few more examples for affected tests, this
might be a slight slowdown - but correspondingly more likely to find a bug.
We've also applied similar tricks to the :ref:`target phase <phases>`, where
they are a pure performance improvement for affected tests.
.. _v6.97.1:
-------------------
6.97.1 - 2024-01-27
-------------------
Improves the performance of the :func:`~hypothesis.extra.numpy.arrays`
strategy when generating unique values.
.. _v6.97.0:
-------------------
6.97.0 - 2024-01-25
-------------------
Changes the distribution of :func:`~hypothesis.strategies.sampled_from` when
sampling from a :class:`~python:enum.Flag`. Previously, no-flags-set values would
never be generated, and all-flags-set values would be unlikely for large enums.
With this change, the distribution is more uniform in the number of flags set.
.. _v6.96.4:
-------------------
6.96.4 - 2024-01-23
-------------------
This patch slightly refactors some internals. There is no user-visible change.
.. _v6.96.3:
-------------------
6.96.3 - 2024-01-22
-------------------
This patch fixes a spurious warning about slow imports when ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY`` was set.
.. _v6.96.2:
-------------------
6.96.2 - 2024-01-21
-------------------
This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
.. _v6.96.1:
-------------------
6.96.1 - 2024-01-18
-------------------
Fix a spurious warning seen when running pytest's test
suite, caused by never realizing we got out of
initialization due to imbalanced hook calls.
.. _v6.96.0:
-------------------
6.96.0 - 2024-01-17
-------------------
Warns when constructing a `repr` that is overly long. This can
happen by accident if stringifying arbitrary strategies, and
is expensive in time and memory. The associated deferring of
these long strings in :func:`~hypothesis.strategies.sampled_from`
should also lead to improved performance.
.. _v6.95.0:
-------------------
6.95.0 - 2024-01-17
-------------------
This release adds the ability to pass any object to :func:`~hypothesis.note`, instead of just strings. The pretty-printed representation of the object will be used.
See also :issue:`3843`.
.. _v6.94.0:
-------------------
6.94.0 - 2024-01-16
-------------------
This release avoids creating a ``.hypothesis`` directory when using
:func:`~hypothesis.strategies.register_type_strategy` (:issue:`3836`),
and adds warnings for plugins which do so by other means or have
other unintended side-effects.
.. _v6.93.2:
-------------------
6.93.2 - 2024-01-15
-------------------
This patch improves :doc:`observability <observability>` reports by moving
timing information from ``metadata`` to a new ``timing`` key, and supporting
conversion of additional argument types to json rather than string reprs
via a ``.to_json()`` method (including e.g. Pandas dataframes).
Additionally, the :obj:`~hypothesis.HealthCheck.too_slow` health check will
now report *which* strategies were slow, e.g. for strategies a, b, c, ...::
count | fraction | slowest draws (seconds)
a | 3 | 65% | -- -- -- 0.357, 2.000
b | 8 | 16% | 0.100, 0.100, 0.100, 0.111, 0.123
c | 3 | 8% | -- -- 0.030, 0.050, 0.200
(skipped 2 rows of fast draws)
.. _v6.93.1:
-------------------
6.93.1 - 2024-01-15
-------------------
This patch refactors some internals, continuing our work on supporting alternative backends
(:issue:`3086`). There is no user-visible change.
.. _v6.93.0:
-------------------
6.93.0 - 2024-01-13
-------------------
The :func:`~hypothesis.extra.lark.from_lark` strategy now accepts an ``alphabet=``
argument, which is passed through to :func:`~hypothesis.strategies.from_regex`,
so that you can e.g. constrain the generated strings to a particular codec.
In support of this feature, :func:`~hypothesis.strategies.from_regex` will avoid
generating optional parts which do not fit the alphabet. For example,
``from_regex(r"abc|def", alphabet="abcd")`` was previously an error, and will now
generate only ``'abc'``. Cases where there are no valid strings remain an error.
.. _v6.92.9:
-------------------
6.92.9 - 2024-01-12
-------------------
This patch refactors some internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
.. _v6.92.8:
-------------------
6.92.8 - 2024-01-11
-------------------
This patch adds a :ref:`test statistics <statistics>` event when a generated example is rejected via :func:`assume <hypothesis.assume>`.
This may also help with distinguishing ``gave_up`` examples in :doc:`observability <observability>` (:issue:`3827`).
.. _v6.92.7:
-------------------
6.92.7 - 2024-01-10
-------------------
This introduces the rewriting of length filters on some collection strategies (:issue:`3791`).
Thanks to Reagan Lee for implementing this feature!
.. _v6.92.6:
-------------------
6.92.6 - 2024-01-08
-------------------
If a test uses :func:`~hypothesis.strategies.sampled_from` on a sequence of
strategies, and raises a ``TypeError``, we now :pep:`add a note <678>` asking
whether you meant to use :func:`~hypothesis.strategies.one_of`.
Thanks to Vince Reuter for suggesting and implementing this hint!
.. _v6.92.5:
-------------------
6.92.5 - 2024-01-08
-------------------
This patch registers explicit strategies for a handful of builtin types,
motivated by improved introspection in PyPy 7.3.14 triggering existing
internal warnings.
Thanks to Carl Friedrich Bolz-Tereick for helping us work out what changed!
.. _v6.92.4:
-------------------
6.92.4 - 2024-01-08
-------------------
This patch fixes an error when writing :doc:`observability <observability>` reports without a pre-existing ``.hypothesis`` directory.
.. _v6.92.3:
-------------------
6.92.3 - 2024-01-08
-------------------
This patch adds a new environment variable ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_NOCOVER``,
which turns on :doc:`observability <observability>` data collection without collecting
code coverage data, which may be faster on Python 3.11 and earlier.
Thanks to Harrison Goldstein for reporting and fixing :issue:`3821`.
.. _v6.92.2:
-------------------
6.92.2 - 2023-12-27
-------------------
This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
.. _v6.92.1:
-------------------
6.92.1 - 2023-12-16
-------------------
This patch fixes a bug introduced in :ref:`version 6.92.0 <v6.92.0>`,
where using the :func:`~hypothesis.strategies.data` strategy would fail
to draw a :func:`~python:dataclasses.dataclass` with a
:class:`~python:collections.defaultdict` field. This was due to a bug
in the standard library which `was fixed in 3.12
<https://github.com/python/cpython/pull/32056>`__, so we've vendored the fix.
.. _v6.92.0:
-------------------
6.92.0 - 2023-12-10
-------------------
This release adds an experimental :wikipedia:`observability <Observability_(software)>`
mode. :doc:`You can read the docs about it here <observability>`.
.. _v6.91.2:
-------------------
6.91.2 - 2023-12-10
-------------------
This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
.. _v6.91.1:
-------------------
6.91.1 - 2023-12-08
-------------------
This patch fixes an issue where :func:`~hypothesis.strategies.builds` could not be used with :pypi:`attrs` objects that defined private attributes (i.e. attributes with a leading underscore). See also :issue:`3791`.
This patch also adds support more generally for using :func:`~hypothesis.strategies.builds` with attrs' ``alias`` parameter, which was previously unsupported.
This patch increases the minimum required version of attrs to 22.2.0.
.. _v6.91.0:
-------------------
6.91.0 - 2023-11-27
-------------------
This release adds an optional ``payload`` argument to :func:`hypothesis.event`,
so that you can clearly express the difference between the label and the value
of an observation. :ref:`statistics` will still summarize it as a string, but
future observability options can preserve the distinction.
.. _v6.90.1:
-------------------
6.90.1 - 2023-11-27
-------------------
This patch supports assigning ``settings = settings(...)`` as a class attribute
on a subclass of a ``.TestCase`` attribute of a :class:`~hypothesis.stateful.RuleBasedStateMachine`.
Previously, this did nothing at all.
.. code-block: python
# works as of this release
class TestMyStatefulMachine(MyStatefulMachine.TestCase):
settings = settings(max_examples=10000)
# the old way still works, but it's more verbose.
MyStateMachine.TestCase.settings = settings(max_examples=10000)
class TestMyStatefulMachine(MyStatefulMachine.TestCase):
pass
Thanks to Joey Tran for reporting these settings-related edge cases in stateful testing.
.. _v6.90.0:
-------------------
6.90.0 - 2023-11-20
-------------------
This release makes it an error to assign ``settings = settings(...)``
as a class attribute on a :class:`~hypothesis.stateful.RuleBasedStateMachine`.
This has never had any effect, and it should be used as a decorator instead:
.. code-block: python
class BadMachine(RuleBasedStateMachine):
"""This doesn't do anything, and is now an error!"""
settings = settings(derandomize=True)
@settings(derandomize=True)
class GoodMachine(RuleBasedStateMachine):
"""This is the right way to do it :-)"""
.. _v6.89.1:
-------------------
6.89.1 - 2023-11-19
-------------------
This patch refactors some internals. There is no user-visible change,
but we hope to improve performance and unlock support for alternative
backends such as :pypi:`symbolic execution with crosshair <crosshair-tool>`
in future (:issue:`3086`).
Thanks to Liam DeVoe for this fantastic contribution!
.. _v6.89.0:
-------------------
6.89.0 - 2023-11-16
-------------------
This release teaches :func:`~hypothesis.strategies.from_type` to handle constraints
implied by the :pypi:`annotated-types` package - as used by e.g. :pypi:`Pydantic`.
This is usually efficient, but falls back to filtering in a few remaining cases.
Thanks to Viicos for :pull:`3780`!
.. _v6.88.4:
-------------------
6.88.4 - 2023-11-13
-------------------
This patch adds a warning when :func:`@st.composite <hypothesis.strategies.composite>`
wraps a function annotated as returning a :class:`~hypothesis.strategies.SearchStrategy`,
since this is usually an error (:issue:`3786`). The function should return a value,
and the decorator will convert it to a function which returns a strategy.
.. _v6.88.3:
-------------------
6.88.3 - 2023-11-05
-------------------
This patch refactors ``from_type(typing.Tuple)``, allowing
:func:`~hypothesis.strategies.register_type_strategy` to take effect
for tuples instead of being silently ignored (:issue:`3750`).
Thanks to Nick Collins for reporting and extensive work on this issue.
.. _v6.88.2:
-------------------
6.88.2 - 2023-11-05
-------------------
This patch improves the speed of the explain phase on python 3.12+, by using the new
:mod:`sys.monitoring` module to collect coverage, instead of :obj:`sys.settrace`.
Thanks to Liam DeVoe for :pull:`3776`!
.. _v6.88.1:
-------------------
6.88.1 - 2023-10-16
-------------------
This patch improves :func:`~hypothesis.strategies.register_type_strategy` when used with ``tuple`` subclasses,
by preventing them from being interpreted as generic and provided to strategies like ``st.from_type(Sequence[int])``
(:issue:`3767`).
.. _v6.88.0:
-------------------
6.88.0 - 2023-10-15
-------------------
This release allows strategy-generating functions registered with
:func:`~hypothesis.strategies.register_type_strategy` to conditionally not
return a strategy, by returning :data:`NotImplemented` (:issue:`3767`).
.. _v6.87.4:
-------------------
6.87.4 - 2023-10-12
-------------------
When :func:`~hypothesis.strategies.randoms` was called with ``use_true_randoms=False``,
calling ``r.sample([], 0)`` would result in an error,
when it should have returned an empty sequence to agree with the normal behaviour of
:func:`random.sample`. This fixes that discrepancy (:issue:`3765`).
.. _v6.87.3:
-------------------
6.87.3 - 2023-10-06
-------------------
This patch ensures that the :ref:`hypothesis codemod <codemods>` CLI
will print a warning instead of stopping with an internal error if
one of your files contains invalid syntax (:issue:`3759`).
.. _v6.87.2:
-------------------
6.87.2 - 2023-10-06
-------------------
This patch makes some small changes to our NumPy integration to ensure forward
compatibility. Thanks to Mateusz Sokół for :pull:`3761`.
.. _v6.87.1:
-------------------
6.87.1 - 2023-10-01
-------------------
Fixes :issue:`3755`, where an internal condition turns out
to be reachable after all.
.. _v6.87.0:
-------------------
6.87.0 - 2023-09-25
-------------------
This release deprecates use of :func:`~hypothesis.assume` and ``reject()``
outside of property-based tests, because these functions work by raising a
special exception (:issue:`3743`). It also fixes some type annotations
(:issue:`3753`).
.. _v6.86.2:
-------------------
6.86.2 - 2023-09-18
-------------------
Hotfix for :issue:`3747`, a bug in explain mode which is so rare that
we missed it in six months of dogfooding. Thanks to :pypi:`mygrad`
for discovering and promptly reporting this!
.. _v6.86.1:
-------------------
6.86.1 - 2023-09-17
-------------------
This patch improves the documentation of :obj:`@example(...).xfail() <hypothesis.example.xfail>`
by adding a note about :pep:`614`, similar to :obj:`@example(...).via() <hypothesis.example.via>`,
and adds a warning when a strategy generates a test case which seems identical to
one provided by an xfailed example.
.. _v6.86.0:
-------------------
6.86.0 - 2023-09-17
-------------------
This release enables the :obj:`~hypothesis.Phase.explain` :ref:`phase <phases>`
by default. We hope it helps you to understand *why* your failing tests have
failed!
.. _v6.85.1:
-------------------
6.85.1 - 2023-09-16
-------------------
This patch switches some of our type annotations to use :obj:`typing.Literal`
when only a few specific values are allowed, such as UUID or IP address versions.
.. _v6.85.0:
-------------------
6.85.0 - 2023-09-16
-------------------
This release deprecates the old whitelist/blacklist arguments
to :func:`~hypothesis.strategies.characters`, in favor of
include/exclude arguments which more clearly describe their
effects on the set of characters which can be generated.
You can :ref:`use Hypothesis' codemods <codemods>` to automatically
upgrade to the new argument names. In a future version, the old
names will start to raise a ``DeprecationWarning``.
.. _v6.84.3:
-------------------
6.84.3 - 2023-09-10
-------------------
This patch automatically disables the :obj:`~hypothesis.HealthCheck.differing_executors`
health check for methods which are also pytest parametrized tests, because
those were mostly false alarms (:issue:`3733`).
.. _v6.84.2:
-------------------
6.84.2 - 2023-09-06
-------------------
Building on recent releases, :func:`~hypothesis.strategies.characters`
now accepts _any_ ``codec=``, not just ``"utf-8"`` and ``"ascii"``.
This includes standard codecs from the :mod:`codecs` module and their
aliases, platform specific and user-registered codecs if they are
available, and `python-specific text encodings
<https://docs.python.org/3/library/codecs.html#python-specific-encodings>`__
(but not text transforms or binary transforms).
.. _v6.84.1:
-------------------
6.84.1 - 2023-09-05
-------------------
This patch by Reagan Lee makes ``st.text(...).filter(str.isidentifier)``
return an efficient custom strategy (:issue:`3480`).
.. _v6.84.0:
-------------------
6.84.0 - 2023-09-04
-------------------
The :func:`~hypothesis.strategies.from_regex` strategy now takes an optional
``alphabet=characters(codec="utf-8")`` argument for unicode strings, like
:func:`~hypothesis.strategies.text`.
This offers more and more-consistent control over the generated strings,
removing previously-hard-coded limitations. With ``fullmatch=False`` and
``alphabet=characters()``, surrogate characters are now possible in leading
and trailing text as well as the body of the match. Negated character classes
such as ``[^A-Z]`` or ``\S`` had a hard-coded exclusion of control characters
and surrogate characters; now they permit anything in ``alphabet=`` consistent
with the class, and control characters are permitted by default.
.. _v6.83.2:
-------------------
6.83.2 - 2023-09-04
-------------------
Add a health check that detects if the same test is executed
several times by :ref:`different executors<custom-function-execution>`.
This can lead to difficult-to-debug problems such as :issue:`3446`.
.. _v6.83.1:
-------------------
6.83.1 - 2023-09-03
-------------------
Pretty-printing of failing examples can now use functions registered with
:func:`IPython.lib.pretty.for_type` or :func:`~IPython.lib.pretty.for_type_by_name`,
as well as restoring compatibility with ``_repr_pretty_`` callback methods
which were accidentally broken in :ref:`version 6.61.2 <v6.61.2>` (:issue:`3721`).
.. _v6.83.0:
-------------------
6.83.0 - 2023-09-01
-------------------
Adds a new ``codec=`` option in :func:`~hypothesis.strategies.characters`, making it
convenient to produce only characters which can be encoded as ``ascii`` or ``utf-8``
bytestrings.
Support for other codecs will be added in a future release.
.. _v6.82.7:
-------------------
6.82.7 - 2023-08-28
-------------------
This patch updates our autoformatting tools, improving our code style without any API changes.
.. _v6.82.6:
-------------------
6.82.6 - 2023-08-20
-------------------
This patch enables and fixes many more of :pypi:`ruff`\ 's lint rules.