Debian Codegraph @

hypothesis-python/docs/changelog.rst

raw
1 =========
2 Changelog
3 =========
4
5 This is a record of all past Hypothesis releases and what went into them,
6 in reverse chronological order. All previous releases are still available
7 :pypi:`on PyPI <hypothesis>`.
8
9
10 Hypothesis 6.x
11 ==============
12
13 .. only:: has_release_file
14
15 --------------------
16 Current pull request
17 --------------------
18
19 .. include:: ../RELEASE.rst
20
21 .. _v6.152.4:
22
23 --------------------
24 6.152.4 - 2026-04-27
25 --------------------
26
27 This patch fixes a rare internal error during |Phase.explain| introduced in :version:`6.149.0` for certain strategies (:issue:`4708`).
28
29 .. _v6.152.3:
30
31 --------------------
32 6.152.3 - 2026-04-26
33 --------------------
34
35 The ``hypothesis-urandom`` :ref:`backend <alternative-backends>` now reads from ``/dev/urandom`` with buffering disabled, which improves the control of those hooking ``/dev/urandom`` to change or read Hypothesis's random decisions.
36
37 .. _v6.152.2:
38
39 --------------------
40 6.152.2 - 2026-04-24
41 --------------------
42
43 This release further improves printing of generated values, building on the changes
44 in :version:`6.151.11`.
45
46 Principle changes:
47
48 * In many cases where we would have printed a complex expression
49 producing a value, we now print the repr (or a pretty-printed version of it).
50 * Additionally, in some cases where we would print a complex expression that involved
51 a lambda, we are now able to simplify that expression into a more readable one.
52
53 .. _v6.152.1:
54
55 --------------------
56 6.152.1 - 2026-04-14
57 --------------------
58
59 Improve some internal type hints.
60
61 .. _v6.152.0:
62
63 --------------------
64 6.152.0 - 2026-04-14
65 --------------------
66
67 Hypothesis generally recommends that the ``.hypothesis`` directory not be checked into version control. As a result, Hypothesis now automatically creates a ``.gitignore`` with ``*`` in the ``.hypothesis`` directory, which excludes it from being tracked by git.
68
69 If you do want to check ``.hypothesis`` into git, you can remove the ``.gitignore`` file. Hypothesis will not re-create it unless the entire ``.hypothesis`` directory is removed.
70
71 .. _v6.151.14:
72
73 ---------------------
74 6.151.14 - 2026-04-13
75 ---------------------
76
77 This patch fixes our |st.from_regex| type annotations so that ``from_regex(..., alphabet=None)`` is accepted.
78
79 This patch also adds unicode line breaks and thai combining vowels to our list of constant strings to upweight at runtime.
80
81 .. _v6.151.13:
82
83 ---------------------
84 6.151.13 - 2026-04-13
85 ---------------------
86
87 This patch removes some newly unnecessary ``# type: ignore`` comments.
88
89 .. _v6.151.12:
90
91 ---------------------
92 6.151.12 - 2026-04-08
93 ---------------------
94
95 This release improves |Phase.explain| output by excluding pytest-related :pypi:`syrupy` files as a possible source of variation.
96
97 .. _v6.151.11:
98
99 ---------------------
100 6.151.11 - 2026-04-05
101 ---------------------
102
103 This patch improves printing of primitive values generated from complex
104 strategies, particularly for :func:`~hypothesis.strategies.from_regex`.
105 Previously, these would often be printed as function calls desctribing
106 how to construct them. Now they will always be printed as a literal value.
107
108 .. _v6.151.10:
109
110 ---------------------
111 6.151.10 - 2026-03-29
112 ---------------------
113
114 When shrinking takes more than five minutes, Hypothesis now prints the
115 ``@seed`` decorator alongside the slow-shrinking warning so you can
116 reproduce the failure.
117
118 Thanks to Ian Hunt-Isaak for this contribution!
119
120 .. _v6.151.9:
121
122 --------------------
123 6.151.9 - 2026-02-16
124 --------------------
125
126 Remove some old unused code.
127
128 .. _v6.151.8:
129
130 --------------------
131 6.151.8 - 2026-02-16
132 --------------------
133
134 This patch fixes a crash when :obj:`sys.modules` contains unhashable values,
135 such as :class:`~types.SimpleNamespace` objects (:issue:`4660`).
136
137 .. _v6.151.7:
138
139 --------------------
140 6.151.7 - 2026-02-16
141 --------------------
142
143 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
144 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
145
146 .. _v6.151.6:
147
148 --------------------
149 6.151.6 - 2026-02-11
150 --------------------
151
152 This patch fixes several duplicate word typos in comments and documentation.
153
154 .. _v6.151.5:
155
156 --------------------
157 6.151.5 - 2026-02-03
158 --------------------
159
160 This patch teaches our pytest plugin to :ref:` find interesting constants <v6.131.1>`
161 when pytest is collecting tests, to avoid arbitrarily attributing the latency
162 to whichever test function happened to be executed first (:issue:`4627`).
163
164 .. _v6.151.4:
165
166 --------------------
167 6.151.4 - 2026-01-29
168 --------------------
169
170 This patch adjusts how we compute the stopping threshold introduced in :version:`6.151.3`, while still maintaining 99% confidence that <1% of test cases pass.
171
172 .. _v6.151.3:
173
174 --------------------
175 6.151.3 - 2026-01-28
176 --------------------
177
178 This patch makes Hypothesis more tolerant of slow-to-satisfy ``assume()`` calls.
179 Previously, Hypothesis would give up after ``max_examples * 10`` attempts; now it
180 uses a statistical test to stop only when 99% confident that <1% of examples
181 would pass (:issue:`4623`).
182
183 Thanks to @ajdavis for this improvement!
184
185 .. _v6.151.2:
186
187 --------------------
188 6.151.2 - 2026-01-26
189 --------------------
190
191 Format our code with the latest version of :pypi:`black`.
192
193 .. _v6.151.1:
194
195 --------------------
196 6.151.1 - 2026-01-26
197 --------------------
198
199 Improve internal categorization of test cases when an :ref:`alternative backend <alternative-backends>` raises |BackendCannotProceed|.
200
201 .. _v6.151.0:
202
203 --------------------
204 6.151.0 - 2026-01-25
205 --------------------
206
207 Add 2025.12 to the list of recognized Array API versions in
208 ``hypothesis.extra.array_api``.
209
210 .. _v6.150.3:
211
212 --------------------
213 6.150.3 - 2026-01-23
214 --------------------
215
216 Hypothesis now generates powers of 2 more often when using |st.integers|.
217
218 .. _v6.150.2:
219
220 --------------------
221 6.150.2 - 2026-01-13
222 --------------------
223
224 Update some internal type hints.
225
226 .. _v6.150.1:
227
228 --------------------
229 6.150.1 - 2026-01-12
230 --------------------
231
232 This patch fixes a bug where |st.recursive| would fail in cases where the
233 ``extend=`` function does not reference it's argument - which was assumed
234 by the recent ``min_leaves=`` feature, because the strategy can't actually
235 recurse otherwise. (:issue:`4638`)
236
237 Now, the historical behavior is working-but-deprecated, or an error if you
238 explicitly pass ``min_leaves=``.
239
240 .. _v6.150.0:
241
242 --------------------
243 6.150.0 - 2026-01-06
244 --------------------
245
246 This release adds a ``min_leaves`` argument to :func:`~hypothesis.strategies.recursive`,
247 which ensures that generated recursive structures have at least the specified number
248 of leaf nodes (:issue:`4205`).
249
250 .. _v6.149.1:
251
252 --------------------
253 6.149.1 - 2026-01-05
254 --------------------
255
256 Add type hints to an internal class.
257
258 .. _v6.149.0:
259
260 --------------------
261 6.149.0 - 2026-01-05
262 --------------------
263
264 This release extends the explain-phase ``# or any other generated value`` comments
265 to sub-arguments within :func:`~hypothesis.strategies.builds`,
266 :func:`~hypothesis.strategies.tuples`, and :func:`~hypothesis.strategies.fixed_dictionaries`.
267
268 Previously, these comments only appeared on top-level test arguments. Now, when
269 the explain phase determines that a sub-argument can vary freely without affecting
270 the test failure, you'll see comments like::
271
272 Falsifying example: test_foo(
273 obj=MyClass(
274 x=0, # or any other generated value
275 y=True,
276 ),
277 data=(
278 '', # or any other generated value
279 42,
280 ),
281 )
282
283 This makes it easier to understand which parts of complex inputs actually matter
284 for reproducing a failure.
285
286 .. _v6.148.13:
287
288 ---------------------
289 6.148.13 - 2026-01-05
290 ---------------------
291
292 Clean up an internal helper.
293
294 .. _v6.148.12:
295
296 ---------------------
297 6.148.12 - 2026-01-04
298 ---------------------
299
300 This patch fixes :func:`~hypothesis.strategies.from_type` to properly handle
301 parameterized type aliases created with Python 3.12+'s :pep:`695` ``type``
302 statement. For example, ``st.from_type(A[int])`` where ``type A[T] = list[T]``
303 now correctly resolves to ``lists(integers())`` instead of raising a
304 ``TypeError`` (:issue:`4628`).
305
306 .. _v6.148.11:
307
308 ---------------------
309 6.148.11 - 2026-01-03
310 ---------------------
311
312 Hypothesis now prints a |Verbosity.verbose| log when we switch away from an :ref:`alternative backend <alternative-backends>`.
313
314 .. _v6.148.10:
315
316 ---------------------
317 6.148.10 - 2026-01-03
318 ---------------------
319
320 Fixes :ref:`Ghostwriter <ghostwriter>` output for :pypi:`numpy` >= 2.4.0. Also adds support |st.from_type| for :pypi:`numpy` 2.5.0 nightly (which has not yet been released).
321
322 .. _v6.148.9:
323
324 --------------------
325 6.148.9 - 2026-01-01
326 --------------------
327
328 |.example| no longer emits |NonInteractiveExampleWarning| when running a python file directly. This means that e.g. ``python my_sandbox.py`` during exploratory work with |.example| will no longer raise warnings.
329
330 .. _v6.148.8:
331
332 --------------------
333 6.148.8 - 2025-12-23
334 --------------------
335
336 Add ``__dict__`` and ``__proto__`` to the list of constant strings Hypothesis sometimes generates.
337
338 .. _v6.148.7:
339
340 --------------------
341 6.148.7 - 2025-12-05
342 --------------------
343
344 When multiple explicit |@example| decorators fail with the same error,
345 Hypothesis now shows only the simplest failing example (by shortlex order)
346 with a note about how many other examples also failed (:issue:`4520`).
347
348 To see all failing examples, use |Verbosity.verbose| or higher.
349
350 .. _v6.148.6:
351
352 --------------------
353 6.148.6 - 2025-12-04
354 --------------------
355
356 Fix a bug where we persisted symbolics from solver-based :ref:`alternative backends <alternative-backends>` in |event|.
357
358 .. _v6.148.5:
359
360 --------------------
361 6.148.5 - 2025-12-01
362 --------------------
363
364 This patch improves the error message for :class:`~hypothesis.errors.FlakyStrategyDefinition`
365 when the precondition for a rule is flaky (:issue:`4206`).
366
367 .. _v6.148.4:
368
369 --------------------
370 6.148.4 - 2025-12-01
371 --------------------
372
373 This patch improves the type annotations for :func:`~hypothesis.extra.numpy.basic_indices`.
374 The return type now accurately reflects the ``allow_ellipsis`` and ``allow_newaxis``
375 parameters, excluding ``EllipsisType`` or ``None`` from the union when those index
376 types are disabled (:issue:`4607`).
377
378 Additionally, :func:`~hypothesis.assume` now has overloaded type annotations:
379 ``assume(True)`` returns ``Literal[True]``, while ``assume(False)`` and
380 ``assume(None)`` return ``NoReturn``.
381
382 .. _v6.148.3:
383
384 --------------------
385 6.148.3 - 2025-11-27
386 --------------------
387
388 Clean up some internal code.
389
390 .. _v6.148.2:
391
392 --------------------
393 6.148.2 - 2025-11-18
394 --------------------
395
396 Document |fuzz_one_input|.
397
398 .. _v6.148.1:
399
400 --------------------
401 6.148.1 - 2025-11-16
402 --------------------
403
404 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
405 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
406
407 .. _v6.148.0:
408
409 --------------------
410 6.148.0 - 2025-11-15
411 --------------------
412
413 Calling :func:`~hypothesis.settings.register_profile` from within a test
414 decorated with :func:`@settings <hypothesis.settings>` is now deprecated,
415 to avoid confusion about which settings are used as the baseline for the
416 new profile.
417
418 .. _v6.147.0:
419
420 --------------------
421 6.147.0 - 2025-11-06
422 --------------------
423
424 This release drops support for :pypi:`nose`, which ceased development 9 years ago and does not support Python 3.10 or newer.
425
426 Hypothesis still supports :pypi:`nose2`. While we do not test ``nose2`` in our CI, we will fix any bugs that get reported.
427
428 .. _v6.146.0:
429
430 --------------------
431 6.146.0 - 2025-11-05
432 --------------------
433
434 |@settings| now accepts equivalent string representations for |settings.verbosity|, |settings.phases|, and |settings.suppress_health_check|. For example:
435
436 .. code-block:: python
437
438 # these two are now equivalent...
439 settings(verbosity=Verbosity.verbose)
440 settings(verbosity="verbose")
441
442 # ...as are these two...
443 settings(phases=[Phase.explicit])
444 settings(phases=["explicit"])
445
446 # ...and these two.
447 settings(suppress_health_check=[HealthCheck.filter_too_much])
448 settings(suppress_health_check=["filter_too_much"])
449
450 This release also changes the canonical value of |Verbosity|, |Phase|, and |HealthCheck| members to a string instead of an integer. For example, ``Phase.reuse.value == "explicit"`` as of this release, where previously ``Phase.reuse.value == 1``.
451
452 Instantiating |Verbosity|, |Phase|, or |HealthCheck| with an integer, such as ``Verbosity(0)``, is now deprecated.
453
454 .. _v6.145.1:
455
456 --------------------
457 6.145.1 - 2025-11-03
458 --------------------
459
460 Refactor some internal logic around strategy definitions.
461
462 .. _v6.145.0:
463
464 --------------------
465 6.145.0 - 2025-11-03
466 --------------------
467
468 Hypothesis previously required :pypi:`attrs` as a dependency. This release removes that dependency, so that the only required dependency of Hypothesis is :pypi:`sortedcontainers`.
469
470 All attrs-specific features of Hypothesis, such as using |st.from_type| with attrs classes, will continue to behave as before.
471
472 .. _v6.144.1:
473
474 --------------------
475 6.144.1 - 2025-11-03
476 --------------------
477
478 Tweak how Hypothesis hides internal tracebacks to fix an error under rare conditions (:issue:`3822`).
479
480 .. _v6.144.0:
481
482 --------------------
483 6.144.0 - 2025-11-02
484 --------------------
485
486 This release adds support for :class:`~fractions.Fraction` objects as ``min_value``
487 and ``max_value`` bounds in :func:`~hypothesis.strategies.decimals`, if they can
488 be exactly represented as decimals in the target precision (:issue:`4466`).
489
490 Bounding :func:`~hypothesis.strategies.decimals` with *other* values that cannot
491 be exactly represented is now deprecated; previously the bounds could be off by one.
492
493 .. _v6.143.1:
494
495 --------------------
496 6.143.1 - 2025-11-02
497 --------------------
498
499 :func:`~hypothesis.strategies.from_type` now correctly handles :pypi:`annotated-types`
500 annotations on :class:`typing.TypedDict` fields which are also marked as being
501 :obj:`~typing.ReadOnly`, :obj:`~typing.Required`, or :obj:`~typing.NotRequired`
502 (:issue:`4474`).
503
504 .. _v6.143.0:
505
506 --------------------
507 6.143.0 - 2025-11-01
508 --------------------
509
510 The extras for |hypothesis-numpy| and |hypothesis-pandas| now support automatically inferring a strategy for ``dtype="O"``. Previously, Hypothesis required an explicit elements strategy to be passed, for example ``nps.arrays("O", shape=(1,), elements=st.just(object()))``. Now, Hypothesis automatically infers ``elements=st.from_type(object)``.
511
512 Thanks to Shaun Read for identifying and fixing this!
513
514 .. _v6.142.5:
515
516 --------------------
517 6.142.5 - 2025-10-31
518 --------------------
519
520 This patch fixes :func:`~hypothesis.extra.ghostwriter.binary_operation` to
521 include imports for :mod:`hypothesis.extra.numpy` strategies such as
522 :func:`~hypothesis.extra.numpy.arrays`, :func:`~hypothesis.extra.numpy.scalar_dtypes`,
523 and :func:`~hypothesis.extra.numpy.array_shapes` when ghostwriting tests for
524 functions with numpy array parameters (:issue:`4576`).
525
526 .. _v6.142.4:
527
528 --------------------
529 6.142.4 - 2025-10-25
530 --------------------
531
532 Improve the accuracy of test timing reports, by tracking the start time of each test case closer to when the test is executed.
533
534 .. _v6.142.3:
535
536 --------------------
537 6.142.3 - 2025-10-22
538 --------------------
539
540 Fix a recursion error when :ref:`observability <observability>` is enabled and a test generates an object with a recursive reference, like ``a = []; a.append(a)``.
541
542 .. _v6.142.2:
543
544 --------------------
545 6.142.2 - 2025-10-20
546 --------------------
547
548 Remove a case where Hypothesis would interact with the global |random.Random| instance if Hypothesis internals were used directly.
549
550 .. _v6.142.1:
551
552 --------------------
553 6.142.1 - 2025-10-16
554 --------------------
555
556 Simplify some internal typing logic after dropping Python 3.9.
557
558 .. _v6.142.0:
559
560 --------------------
561 6.142.0 - 2025-10-16
562 --------------------
563
564 This release drops support for Python 3.9, `which reached end of life in
565 October 2025 <https://devguide.python.org/versions/>`__.
566
567 .. _v6.141.1:
568
569 --------------------
570 6.141.1 - 2025-10-15
571 --------------------
572
573 Fixes an error when using :ref:`the Ghostwriter <ghostwriter>` with annotations that include :obj:`python:typing.ForwardRef` on Python 3.14 (:issue:`4565`).
574
575 .. _v6.141.0:
576
577 --------------------
578 6.141.0 - 2025-10-15
579 --------------------
580
581 The |django.from_field| and |django.from_form| strategies from our :ref:`Django extra <hypothesis-django>` now support :obj:`~django:django.db.models.FileField`.
582
583 Thanks to Arjoonn Sharma for this fix!
584
585 .. _v6.140.4:
586
587 --------------------
588 6.140.4 - 2025-10-14
589 --------------------
590
591 Clean up internal ``@overload`` type annotations.
592
593 .. _v6.140.3:
594
595 --------------------
596 6.140.3 - 2025-10-04
597 --------------------
598
599 Fixes our bundled |run_conformance_test| not respecting |PrimitiveProvider.avoid_realization|.
600
601 .. _v6.140.2:
602
603 --------------------
604 6.140.2 - 2025-09-23
605 --------------------
606
607 The automatic switch to the CI :class:`settings profile <hypothesis.settings>` now works under :pypi:`tox` (for ``tox >= 4.30.0``).
608
609 .. _v6.140.1:
610
611 --------------------
612 6.140.1 - 2025-09-22
613 --------------------
614
615 This patch re-enables the warning for incompatible :func:`~hypothesis.strategies.shared`
616 strategies that was first enabled in :v:`6.133.0` but disabled in :v:`6.135.15`.
617
618 .. _v6.140.0:
619
620 --------------------
621 6.140.0 - 2025-09-22
622 --------------------
623
624 |st.characters| now validates that the elements of the ``exclude_characters`` and ``include_characters`` arguments are single characters, which was always assumed internally. For example, ``exclude_characters=["a", "b"]`` is valid while ``exclude_characters=["ab"]`` will now raise an error up-front.
625
626 .. _v6.139.3:
627
628 --------------------
629 6.139.3 - 2025-09-22
630 --------------------
631
632 Add ``phase`` to the :ref:`hypothesis-specific metadata <observability-hypothesis-metadata>` in :ref:`observability <observability>`.
633
634 .. _v6.139.2:
635
636 --------------------
637 6.139.2 - 2025-09-18
638 --------------------
639
640 Internal refactoring for new lint rules.
641
642 .. _v6.139.1:
643
644 --------------------
645 6.139.1 - 2025-09-16
646 --------------------
647
648 Fixed another typo in error message around function-scoped fixtures.
649
650 .. _v6.139.0:
651
652 --------------------
653 6.139.0 - 2025-09-16
654 --------------------
655
656 Add |settings.get_current_profile_name|, which returns the name of the current settings profile.
657
658 .. _v6.138.17:
659
660 ---------------------
661 6.138.17 - 2025-09-15
662 ---------------------
663
664 Fixed typo in error message around function-scoped fixtures.
665
666 .. _v6.138.16:
667
668 ---------------------
669 6.138.16 - 2025-09-13
670 ---------------------
671
672 Improved error message for |DeadlineExceeded|.
673
674 .. _v6.138.15:
675
676 ---------------------
677 6.138.15 - 2025-09-08
678 ---------------------
679
680 Refactor some stateful testing internals for easier use by third-party libraries.
681
682 .. _v6.138.14:
683
684 ---------------------
685 6.138.14 - 2025-09-02
686 ---------------------
687
688 Patch files written by hypothesis now use a deterministic ordering when multiple |@example| decorators are present.
689
690 .. _v6.138.13:
691
692 ---------------------
693 6.138.13 - 2025-09-01
694 ---------------------
695
696 Fix a typo affecting pretty-printing of lambdas with complex default
697 arguments.
698
699 .. _v6.138.12:
700
701 ---------------------
702 6.138.12 - 2025-09-01
703 ---------------------
704
705 Improve automatic detection of the :ref:`CI profile <builtin-profiles>` on various vendor-specific CI systems.
706
707 .. _v6.138.11:
708
709 ---------------------
710 6.138.11 - 2025-09-01
711 ---------------------
712
713 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
714 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
715
716 .. _v6.138.10:
717
718 ---------------------
719 6.138.10 - 2025-08-31
720 ---------------------
721
722 Internal refactor to simplify |SearchStrategy|.
723
724 .. _v6.138.9:
725
726 --------------------
727 6.138.9 - 2025-08-31
728 --------------------
729
730 This patch further improves stringification of lambdas, by
731 never returning a lambda source unless it is confirmed to
732 compile to the same code object. This stricter check makes
733 it possible to widen the search for a matching source block,
734 so that it can often be found even if the file has been
735 edited.
736
737 .. _v6.138.8:
738
739 --------------------
740 6.138.8 - 2025-08-29
741 --------------------
742
743 Fixes a race condition under threading when using |st.deferred|.
744
745 .. _v6.138.7:
746
747 --------------------
748 6.138.7 - 2025-08-28
749 --------------------
750
751 Improves upon the cache eviction problem workaround
752 of :v:`6.135.12`.
753
754 .. _v6.138.6:
755
756 --------------------
757 6.138.6 - 2025-08-27
758 --------------------
759
760 Documentation tweaks.
761
762 .. _v6.138.5:
763
764 --------------------
765 6.138.5 - 2025-08-27
766 --------------------
767
768 Fixes a race condition under threading for strategies which trigger our filter-rewriting rules, like ``st.integers().filter(lambda x: abs(x) > 100)``.
769
770 .. _v6.138.4:
771
772 --------------------
773 6.138.4 - 2025-08-27
774 --------------------
775
776 One of our shrinking passes for reducing failing inputs targets failures which require two numbers to add to the same value. This pass previously only worked for positive numbers. This patch fixes that, so it also works for negative numbers.
777
778 .. _v6.138.3:
779
780 --------------------
781 6.138.3 - 2025-08-24
782 --------------------
783
784 This patch slightly improves the cache-hit rate for
785 |st.dictionaries| and certain unique |st.lists|.
786
787 .. _v6.138.2:
788
789 --------------------
790 6.138.2 - 2025-08-16
791 --------------------
792
793 The type annotations for |st.register_type_strategy| now indicate that it accepts registering types created with |TypeAliasType| (aka ``type MyType = int``).
794
795 .. _v6.138.1:
796
797 --------------------
798 6.138.1 - 2025-08-15
799 --------------------
800
801 Internal refactoring and cleanup. As a result, ``hypothesis[cli]`` and ``hypothesis[ghostwriter]`` now require ``black>=20.8b0`` instead of the previous ``black>=19.10b0``.
802
803 .. _v6.138.0:
804
805 --------------------
806 6.138.0 - 2025-08-13
807 --------------------
808
809 On Python 3.14, |memoryview| is newly generic. This release adds the ability for |st.from_type| to resolve generic |memoryview| types on 3.14, like ``st.from_type(memoryview[CustomBufferClass])`` . ``CustomBufferClass`` must implement ``__buffer__``, as expected by |memoryview|.
810
811 .. _v6.137.3:
812
813 --------------------
814 6.137.3 - 2025-08-11
815 --------------------
816
817 This patch makes the stringification of lambdas, and as
818 a result certain automatic filter rewriting operations,
819 more robust. This fixes :issue:`4498`, where a lambda
820 was mistakenly identified as the identity operator due
821 to :func:`inspect.getsource` only returning the first
822 line of the lambda definition.
823
824 As a result, the ``repr`` of strategies filtered or
825 mapped by lambda functions may change slightly.
826
827 .. _v6.137.2:
828
829 --------------------
830 6.137.2 - 2025-08-11
831 --------------------
832
833 Add support for Python 3.14, `which is currently in release candidate 1 <https://devguide.python.org/versions/>`_.
834
835 .. _v6.137.1:
836
837 --------------------
838 6.137.1 - 2025-08-05
839 --------------------
840
841 Fixes a bug with solver-based :ref:`alternative backends <alternative-backends>` (like `crosshair <https://github.com/pschanely/CrossHair>`_) where symbolic values passed to |event| would not be realized to concrete values at the end of the test case.
842
843 .. _v6.137.0:
844
845 --------------------
846 6.137.0 - 2025-08-05
847 --------------------
848
849 Add the |add_observability_callback|, |remove_observability_callback|, |with_observability_callback|, and |observability_enabled| methods to the :ref:`observability <observability>` interface. The previous |TESTCASE_CALLBACKS| is deprecated.
850
851 This release also adds better threading support to observability callbacks. An observability callback will now only be called for observations generated by the same thread.
852
853 .. _v6.136.9:
854
855 --------------------
856 6.136.9 - 2025-08-04
857 --------------------
858
859 Fix a threading race condition in |st.one_of| initialization.
860
861 .. _v6.136.8:
862
863 --------------------
864 6.136.8 - 2025-08-04
865 --------------------
866
867 Improve the error messages and documentation for |HealthCheck|. Among others, the messaging is now more clear that health checks are proactive warnings, not correctness errors.
868
869 .. _v6.136.7:
870
871 --------------------
872 6.136.7 - 2025-08-01
873 --------------------
874
875 Improve detection of sys.monitoring to avoid errors on GraalPy.
876
877 .. _v6.136.6:
878
879 --------------------
880 6.136.6 - 2025-07-28
881 --------------------
882
883 When a test is executed concurrently from multiple threads, |HealthCheck.too_slow| is now disabled, since the Python runtime may decide to switch away from a thread for arbitrarily long and Hypothesis cannot track execution time per-thread.
884
885 .. _v6.136.5:
886
887 --------------------
888 6.136.5 - 2025-07-28
889 --------------------
890
891 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
892 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
893
894 .. _v6.136.4:
895
896 --------------------
897 6.136.4 - 2025-07-25
898 --------------------
899
900 |HealthCheck.differing_executors| is no longer raised if a test is executed by different executors from different threads. |HealthCheck.differing_executors| will still be raised if a test is executed by different executors in the same thread.
901
902 .. _v6.136.3:
903
904 --------------------
905 6.136.3 - 2025-07-23
906 --------------------
907
908 When a test is executed concurrently from multiple threads, |DeadlineExceeded| is now disabled, since the Python runtime may decide to switch away from a thread for longer than |settings.deadline|, and Hypothesis cannot track execution time per-thread. See :issue:`4478`.
909
910 .. _v6.136.2:
911
912 --------------------
913 6.136.2 - 2025-07-21
914 --------------------
915
916 |@precondition| now errors if used without |@rule| or |@invariant|. Doing so has no effect and is indicative of a user error (:issue:`4413`).
917
918 .. _v6.136.1:
919
920 --------------------
921 6.136.1 - 2025-07-20
922 --------------------
923
924 Fix |PrimitiveProvider.on_observation| being called with observations it wasn't responsible for generating if the test failed.
925
926 .. _v6.136.0:
927
928 --------------------
929 6.136.0 - 2025-07-19
930 --------------------
931
932 When a failure found by an :ref:`alternative backend <alternative-backends>` does not reproduce under the Hypothesis backend, we now raise |FlakyBackendFailure| instead of an internal ``FlakyReplay`` exception.
933
934 .. _v6.135.33:
935
936 ---------------------
937 6.135.33 - 2025-07-18
938 ---------------------
939
940 Speculative fix for a thread-safety issue in calculating strategy labels.
941
942 .. _v6.135.32:
943
944 ---------------------
945 6.135.32 - 2025-07-15
946 ---------------------
947
948 Improve the thread-safety of strategy validation.
949
950 Before this release, Hypothesis did not require that ``super().__init__()`` be called in ``SearchStrategy`` subclasses. Subclassing ``SearchStrategy`` is not supported or part of the public API, but if you are subclassing it anyway, you will need to make sure to call ``super().__init__()`` after this release.
951
952 .. _v6.135.31:
953
954 ---------------------
955 6.135.31 - 2025-07-15
956 ---------------------
957
958 Fix a remaining thread-safety issue with the deprecation warning for use of the global random instance (see :ref:`v6.135.24 <v6.135.24>`).
959
960 .. _v6.135.30:
961
962 ---------------------
963 6.135.30 - 2025-07-14
964 ---------------------
965
966 Fix a remaining thread-safety issue with the recursion limit warning Hypothesis issues when an outside caller sets ``sys.setrecursionlimit`` (see :ref:`v6.135.23 <v6.135.23>`).
967
968 .. _v6.135.29:
969
970 ---------------------
971 6.135.29 - 2025-07-12
972 ---------------------
973
974 Optimize performance of |st.sampled_from| and internal selection of :ref:`stateful testing <stateful>` rules.
975
976 .. _v6.135.28:
977
978 ---------------------
979 6.135.28 - 2025-07-12
980 ---------------------
981
982 Optimize the memory and speed of an internal datastructure for compactly storing integers.
983
984 .. _v6.135.27:
985
986 ---------------------
987 6.135.27 - 2025-07-12
988 ---------------------
989
990 Improve thread-safety for stateful |@initialize| rules.
991
992 .. _v6.135.26:
993
994 ---------------------
995 6.135.26 - 2025-07-05
996 ---------------------
997
998 Fix a "dictionary changed size during iteration" error that could occur under with |register_random| under multiple threads.
999
1000 .. _v6.135.25:
1001
1002 ---------------------
1003 6.135.25 - 2025-07-05
1004 ---------------------
1005
1006 Improve thread safety of our :mod:`sys.monitoring` usage (by the |Phase.shrink| and |Phase.explain| phases), as well as the internal computation of strategy labels.
1007
1008 .. _v6.135.24:
1009
1010 ---------------------
1011 6.135.24 - 2025-07-03
1012 ---------------------
1013
1014 Makes the deprecation warning for using the global random instance thread-safe, as part of our work towards thread safety (:issue:`4451`).
1015
1016 .. _v6.135.23:
1017
1018 ---------------------
1019 6.135.23 - 2025-07-02
1020 ---------------------
1021
1022 In order to de-flake ``RecursionError`` failures, Hypothesis sets a deterministic limit on ``sys.setrecursionlimit``. This patch makes the setting of this limit aware of uses by Hypothesis from multiple threads, so it does not produce spurious warnings in multithreaded environments.
1023
1024 .. _v6.135.22:
1025
1026 ---------------------
1027 6.135.22 - 2025-07-02
1028 ---------------------
1029
1030 Improves the thread safety of caching strategy definitions, as well as usage of strategy transformations like |.map| and |.filter|.
1031
1032 .. _v6.135.21:
1033
1034 ---------------------
1035 6.135.21 - 2025-07-02
1036 ---------------------
1037
1038 Fix the thread safety of |@rule| definitions in |RuleBasedStateMachine|.
1039
1040 .. _v6.135.20:
1041
1042 ---------------------
1043 6.135.20 - 2025-06-30
1044 ---------------------
1045
1046 Fixes ``reproduction_decorator`` being missing under :ref:`hypothesis-specific metadata <observability-hypothesis-metadata>` in many :ref:`observability <observability>` observations, when it should have been present.
1047
1048 .. _v6.135.19:
1049
1050 ---------------------
1051 6.135.19 - 2025-06-30
1052 ---------------------
1053
1054 Improve threading compatibility of an internal helper for managing deterministic rng seeding.
1055
1056 .. _v6.135.18:
1057
1058 ---------------------
1059 6.135.18 - 2025-06-30
1060 ---------------------
1061
1062 Remove an internal assertion which could trigger if (1) a lambda was present in the source code of a test, (2) and the source code file was edited on disk between the start of the python process and when Hypothesis runs the property.
1063
1064 .. _v6.135.17:
1065
1066 ---------------------
1067 6.135.17 - 2025-06-30
1068 ---------------------
1069
1070 Refactor some internals related to the shrinker for better compatibility with free-threading (:issue:`4451`).
1071
1072 .. _v6.135.16:
1073
1074 ---------------------
1075 6.135.16 - 2025-06-26
1076 ---------------------
1077
1078 Fixes an error when the ``_pytest`` module is present in ``sys.modules``, but *not* the ``_pytest.outcomes`` or ``_pytest.fixtures`` modules. This can happen with code that imports just ``_pytest``, without importing ``pytest``.
1079
1080 .. _v6.135.15:
1081
1082 ---------------------
1083 6.135.15 - 2025-06-25
1084 ---------------------
1085
1086 Temporarily disable the warning when |st.shared| strategies with the same ``key`` draw from different base strategies, due to false alarms. Once we fix the false alarms in a future release, the warning will be re-enabled.
1087
1088 .. _v6.135.14:
1089
1090 ---------------------
1091 6.135.14 - 2025-06-20
1092 ---------------------
1093
1094 Speed up usages of |st.sampled_from| by deferring evaluation of its repr, and truncating its repr for large collections (over 512 elements). This is especially noticeable when using |st.sampled_from| with large collections. The repr of |st.sampled_from| strategies involving sequence classes with custom reprs may change as a result of this release.
1095
1096 .. _v6.135.13:
1097
1098 ---------------------
1099 6.135.13 - 2025-06-20
1100 ---------------------
1101
1102 Fixes a substantial performance regression in stateful tests from computing string representations, present since :ref:`version 6.131.20 <v6.131.20>`.
1103
1104 .. _v6.135.12:
1105
1106 ---------------------
1107 6.135.12 - 2025-06-19
1108 ---------------------
1109
1110 Fix a rare race condition in internal cache eviction logic.
1111
1112 .. _v6.135.11:
1113
1114 ---------------------
1115 6.135.11 - 2025-06-17
1116 ---------------------
1117
1118 This patch fixes an error when importing :ref:`our django extra <hypothesis-django>` (via ``hypothesis.extra.django``) if ``django.contrib.auth`` was not in ``INSTALLED_APPS`` (:issue:`3716`).
1119
1120 Thanks to Chris Wesseling for this fix!
1121
1122 .. _v6.135.10:
1123
1124 ---------------------
1125 6.135.10 - 2025-06-15
1126 ---------------------
1127
1128 Fix a rare race condition in |ExampleDatabase.fetch|, where we might have read from a non-existent directory.
1129
1130 .. _v6.135.9:
1131
1132 --------------------
1133 6.135.9 - 2025-06-13
1134 --------------------
1135
1136 Refactor some internal code related to patches to make it easier to test.
1137
1138 .. _v6.135.8:
1139
1140 --------------------
1141 6.135.8 - 2025-06-13
1142 --------------------
1143
1144 Add type hints to internal code for patching.
1145
1146 .. _v6.135.7:
1147
1148 --------------------
1149 6.135.7 - 2025-06-12
1150 --------------------
1151
1152 Fixes a race condition in |ExampleDatabase.add_listener| for |DirectoryBasedExampleDatabase| after version :ref:`6.135.1 <v6.135.1>` where the listener might have tried to read a file that doesn't exist.
1153
1154 .. _v6.135.6:
1155
1156 --------------------
1157 6.135.6 - 2025-06-11
1158 --------------------
1159
1160 This patch corrects the f-string formatting of a few array-related error messages.
1161
1162 .. _v6.135.5:
1163
1164 --------------------
1165 6.135.5 - 2025-06-10
1166 --------------------
1167
1168 Improve the error message when applying |@given| to a :pypi:`pytest` fixture with pytest 8.4.0.
1169
1170 .. _v6.135.4:
1171
1172 --------------------
1173 6.135.4 - 2025-06-09
1174 --------------------
1175
1176 Further improve the performance of the constants-collection feature introduced in :ref:`version 6.131.1 <v6.131.1>`, by ignoring large files and files with many constants.
1177
1178 .. _v6.135.3:
1179
1180 --------------------
1181 6.135.3 - 2025-06-08
1182 --------------------
1183
1184 This release adds the experimental and unstable |OBSERVABILITY_CHOICES| option for :ref:`observability <observability>`. If set, the choice sequence is included in ``metadata.choice_nodes``, and choice sequence spans are included in ``metadata.choice_spans``.
1185
1186 These are relatively low-level implementation detail of Hypothesis, and are exposed in observability for users building tools or research on top of Hypothesis. See |PrimitiveProvider| for more details about the choice sequence and choice spans.
1187
1188 We are actively working towards a better interface for this. Feel free to use |OBSERVABILITY_CHOICES| to experiment, but don't rely on it yet!
1189
1190 .. _v6.135.2:
1191
1192 --------------------
1193 6.135.2 - 2025-06-08
1194 --------------------
1195
1196 This patch restores compatibility when using `the legacy Python 3.9 LL(1)
1197 parser <https://docs.python.org/3/whatsnew/3.9.html#new-parser>`__ yet
1198 again, because the fix in :ref:`version 6.131.33 <v6.131.33>` was too
1199 brittle.
1200
1201 Thanks to Marco Ricci for this fix!
1202
1203 .. _v6.135.1:
1204
1205 --------------------
1206 6.135.1 - 2025-06-05
1207 --------------------
1208
1209 |DirectoryBasedExampleDatabase| now removes empty directories after |ExampleDatabase.delete| is called.
1210
1211 .. _v6.135.0:
1212
1213 --------------------
1214 6.135.0 - 2025-06-03
1215 --------------------
1216
1217 This release adds :func:`~hypothesis.internal.conjecture.provider_conformance.run_conformance_test`, for use in testing implementations of :ref:`alternative backends <alternative-backends>`.
1218
1219 .. _v6.134.0:
1220
1221 --------------------
1222 6.134.0 - 2025-06-03
1223 --------------------
1224
1225 This patch adds :class:`hypothesis.extra.django.SimpleTestCase` (:issue:`4117`)
1226
1227 Thanks to Chris Wesseling for this contribution!
1228
1229 .. _v6.133.2:
1230
1231 --------------------
1232 6.133.2 - 2025-06-03
1233 --------------------
1234
1235 Internal changes to support `hypofuzz <https://hypofuzz.com>`__.
1236
1237 .. _v6.133.1:
1238
1239 --------------------
1240 6.133.1 - 2025-06-03
1241 --------------------
1242
1243 The ``to_json`` hook used internally when writing :ref:`observability <observability>` reports is now supported on nested dataclasses (in addition to outermost dataclasses).
1244
1245 .. _v6.133.0:
1246
1247 --------------------
1248 6.133.0 - 2025-06-02
1249 --------------------
1250
1251 Warn when :func:`~hypothesis.strategies.shared` strategies with the same ``key``
1252 draw from different base strategies. This could lead to subtle failures or
1253 lower-than-expected example coverage.
1254
1255 .. _v6.132.0:
1256
1257 --------------------
1258 6.132.0 - 2025-05-31
1259 --------------------
1260
1261 Add |PrimitiveProvider.on_observation| to the internal :ref:`alternative backends <alternative-backends-internals>` interface.
1262
1263 .. _v6.131.33:
1264
1265 ---------------------
1266 6.131.33 - 2025-05-31
1267 ---------------------
1268
1269 This patch restores compatibility when using `the legacy Python 3.9 LL(1)
1270 parser <https://docs.python.org/3/whatsnew/3.9.html#new-parser>`__, which
1271 was accidentally broken since :ref:`version 6.130.13 <v6.130.13>`.
1272
1273 Thanks to Marco Ricci for this fix!
1274
1275 .. _v6.131.32:
1276
1277 ---------------------
1278 6.131.32 - 2025-05-30
1279 ---------------------
1280
1281 :ref:`fuzz_one_input <fuzz_one_input>` now writes :ref:`observability reports <observability>` if observability is enabled, bringing it in line with the behavior of other standard ways to invoke a Hypothesis test.
1282
1283 .. _v6.131.31:
1284
1285 ---------------------
1286 6.131.31 - 2025-05-30
1287 ---------------------
1288
1289 Improve documentation of |@example|.
1290
1291 .. _v6.131.30:
1292
1293 ---------------------
1294 6.131.30 - 2025-05-27
1295 ---------------------
1296
1297 This patch resolves a Pandas FutureWarning (:issue:`4400`) caused by indexing with an integer key.
1298
1299 .. _v6.131.29:
1300
1301 ---------------------
1302 6.131.29 - 2025-05-27
1303 ---------------------
1304
1305 The observations passed to |TESTCASE_CALLBACKS| are now dataclasses, rather than dictionaries. The content written to ``.hypothesis/observed`` under ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY`` remains the same.
1306
1307 .. _v6.131.28:
1308
1309 ---------------------
1310 6.131.28 - 2025-05-25
1311 ---------------------
1312
1313 Add documentation to some internal APIs.
1314
1315 .. _v6.131.27:
1316
1317 ---------------------
1318 6.131.27 - 2025-05-24
1319 ---------------------
1320
1321 Add ``PrimitiveProvider.replay_choices`` to the :ref:`alternative backends <alternative-backends>` interface, to support warm-starting e.g. :pypi:`hypothesis-crosshair` from :pypi:`hypofuzz`.
1322
1323 .. _v6.131.26:
1324
1325 ---------------------
1326 6.131.26 - 2025-05-24
1327 ---------------------
1328
1329 Improve |ExampleDatabase| documentation.
1330
1331 .. _v6.131.25:
1332
1333 ---------------------
1334 6.131.25 - 2025-05-23
1335 ---------------------
1336
1337 Add some internal type hints.
1338
1339 .. _v6.131.24:
1340
1341 ---------------------
1342 6.131.24 - 2025-05-23
1343 ---------------------
1344
1345 Improve |@settings| documentation.
1346
1347 .. _v6.131.23:
1348
1349 ---------------------
1350 6.131.23 - 2025-05-23
1351 ---------------------
1352
1353 This patch adds ``GITLAB_CI`` to the environment variables checked when enabling the default CI |settings| profile.
1354
1355 Thanks to Genevieve Mendoza for this contribution!
1356
1357 .. _v6.131.22:
1358
1359 ---------------------
1360 6.131.22 - 2025-05-22
1361 ---------------------
1362
1363 Include |note| and |Phase.explain| output in the "representation" field of :ref:`observability reports <observability>` for failing examples, to more closely match the output produced by Hypothesis.
1364
1365 .. _v6.131.21:
1366
1367 ---------------------
1368 6.131.21 - 2025-05-21
1369 ---------------------
1370
1371 |BackgroundWriteDatabase| instances now defer creating and starting a thread until first use.
1372
1373 .. _v6.131.20:
1374
1375 ---------------------
1376 6.131.20 - 2025-05-20
1377 ---------------------
1378
1379 Improve the string representation of |st.characters| in some cases.
1380
1381 .. _v6.131.19:
1382
1383 ---------------------
1384 6.131.19 - 2025-05-19
1385 ---------------------
1386
1387 Cap the length of bytestrings collected as part of the constants-collection feature introduced in :ref:`version 6.131.1 <v6.131.1>`, as long bytestrings are unlikely to be useful.
1388
1389 .. _v6.131.18:
1390
1391 ---------------------
1392 6.131.18 - 2025-05-17
1393 ---------------------
1394
1395 All |ExampleDatabase| implementations in Hypothesis now implement ``__eq__``.
1396
1397 .. _v6.131.17:
1398
1399 ---------------------
1400 6.131.17 - 2025-05-14
1401 ---------------------
1402
1403 Further improve the performance of the new features introduced in :ref:`version 6.131.1 <v6.131.1>`, by improving unions of large sets.
1404
1405 .. _v6.131.16:
1406
1407 ---------------------
1408 6.131.16 - 2025-05-13
1409 ---------------------
1410
1411 Improve performance of an internal method to count possible choices.
1412
1413 .. _v6.131.15:
1414
1415 ---------------------
1416 6.131.15 - 2025-05-07
1417 ---------------------
1418
1419 Improves output when assigning values to multiple target bundles
1420 in a stateful rule (:issue:`4361`).
1421
1422 .. _v6.131.14:
1423
1424 ---------------------
1425 6.131.14 - 2025-05-07
1426 ---------------------
1427
1428 Internal optimization to reduce redundant choice sequence spans.
1429
1430 .. _v6.131.13:
1431
1432 ---------------------
1433 6.131.13 - 2025-05-07
1434 ---------------------
1435
1436 Add a ``for_failure: bool = False`` parameter to ``provider.realize`` in :ref:`alternative backends <alternative-backends>`, so that symbolic-based backends can increase their timeouts when realizing failures, which are more important than regular examples.
1437
1438 .. _v6.131.12:
1439
1440 ---------------------
1441 6.131.12 - 2025-05-06
1442 ---------------------
1443
1444 Improve type hints for the single-argument form of |st.one_of|. ``st.one_of(strategies)`` now matches the type of ``st.one_of(*strategies)``. For instance, ``st.one_of([st.integers(), st.none()])`` now has the correct type of ``SearchStrategy[int | None]`` instead of ``SearchStrategy[Any]``.
1445
1446 .. _v6.131.11:
1447
1448 ---------------------
1449 6.131.11 - 2025-05-06
1450 ---------------------
1451
1452 Fix incorrectly reporting :ref:`alternative backends <alternative-backends>` as unsound in some cases.
1453
1454 .. _v6.131.10:
1455
1456 ---------------------
1457 6.131.10 - 2025-05-06
1458 ---------------------
1459
1460 Remove more false-positive locations from |Phase.explain| output, and add a new ``metadata.reproduction_decorator`` field in :ref:`observability reports <observability>` for failing examples.
1461
1462 .. _v6.131.9:
1463
1464 --------------------
1465 6.131.9 - 2025-04-25
1466 --------------------
1467
1468 Fix a ``BytesWarning`` after :ref:`version 6.131.1 <v6.131.1>` if the source code used the same value in both a normal and binary string.
1469
1470 .. _v6.131.8:
1471
1472 --------------------
1473 6.131.8 - 2025-04-23
1474 --------------------
1475
1476 |DirectoryBasedExampleDatabase| will now fall back to (potentially non-atomic)
1477 copies rather than renames, if the temporary directory used for atomic
1478 write-and-rename is on a different filesystem to the configured database
1479 location (:issue:`4335`).
1480
1481 .. _v6.131.7:
1482
1483 --------------------
1484 6.131.7 - 2025-04-22
1485 --------------------
1486
1487 Further improve the performance of the new features introduced in :ref:`version 6.131.1 <v6.131.1>`.
1488
1489 .. _v6.131.6:
1490
1491 --------------------
1492 6.131.6 - 2025-04-19
1493 --------------------
1494
1495 This patch makes the new features introduced in :ref:`version 6.131.1 <v6.131.1>` much
1496 faster, and fixes an internal ``RecursionError`` when working with deeply-nested code.
1497
1498 .. _v6.131.5:
1499
1500 --------------------
1501 6.131.5 - 2025-04-18
1502 --------------------
1503
1504 Fix a rare case where database entries were kept after they were no longer needed when using |Phase.target|.
1505
1506 .. _v6.131.4:
1507
1508 --------------------
1509 6.131.4 - 2025-04-18
1510 --------------------
1511
1512 Internal refactoring of the |@settings| object, with no user-visible change.
1513
1514 .. _v6.131.3:
1515
1516 --------------------
1517 6.131.3 - 2025-04-18
1518 --------------------
1519
1520 Fixes a rare internal error where new code from :ref:`version 6.131.1 <v6.131.1>`
1521 could fail if :py:data:`sys.modules` is simultaneously modified, e.g. as a side
1522 effect of imports executed from another thread. Our :ref:`thread-safety-policy`
1523 does not promise that this is supported, but we're happy to take reasonable
1524 fixes.
1525
1526 Thanks to Tony Li for reporting and fixing this issue.
1527
1528 .. _v6.131.2:
1529
1530 --------------------
1531 6.131.2 - 2025-04-17
1532 --------------------
1533
1534 The pub-sub change listening interface of the :ref:`Hypothesis database <database>` now correctly fires events for |DirectoryBasedExampleDatabase| if the directory was created after the listener was added.
1535
1536 Also disables on emscripten the constants-extraction feature introduced in :ref:`v6.131.1`, where it caused substantial slowdown.
1537
1538 .. _v6.131.1:
1539
1540 --------------------
1541 6.131.1 - 2025-04-17
1542 --------------------
1543
1544 Hypothesis now looks for constant values in the source code of your program, and sometimes uses them while generating examples. This lets Hypothesis generate interesting inputs that are specific to your program.
1545
1546 .. _v6.131.0:
1547
1548 --------------------
1549 6.131.0 - 2025-04-10
1550 --------------------
1551
1552 Add |is_hypothesis_test|, for third-party libraries which want to determine whether a test has been defined with Hypothesis.
1553
1554 .. _v6.130.13:
1555
1556 ---------------------
1557 6.130.13 - 2025-04-09
1558 ---------------------
1559
1560 Refactor some internals.
1561
1562 .. _v6.130.12:
1563
1564 ---------------------
1565 6.130.12 - 2025-04-09
1566 ---------------------
1567
1568 Lays some groundwork for future work on collecting interesting literals from the code being tested, for increased bug-finding power (:issue:`3127`). There is no user-visible change (yet!)
1569
1570 .. _v6.130.11:
1571
1572 ---------------------
1573 6.130.11 - 2025-04-08
1574 ---------------------
1575
1576 Fix the caching behavior of |st.sampled_from|, which in rare cases led to failing an internal assertion (:issue:`4339`).
1577
1578 .. _v6.130.10:
1579
1580 ---------------------
1581 6.130.10 - 2025-04-07
1582 ---------------------
1583
1584 This patch deprecates creating a database using the abstract ``ExampleDatabase()`` class. Use one of the following instead:
1585
1586 * Replace ``ExampleDatabase(":memory:")`` with |InMemoryExampleDatabase|.
1587 * Replace ``ExampleDatabase("/path/to/dir")`` with |DirectoryBasedExampleDatabase|.
1588 * Replace ``ExampleDatabase()`` with either |InMemoryExampleDatabase| or |DirectoryBasedExampleDatabase|, depending on your needs. Previously, Hypothesis interpreted ``ExampleDatabase()`` as a |DirectoryBasedExampleDatabase| in the default ``.hypothesis`` directory, with a fallback to |InMemoryExampleDatabase| if that location was not available.
1589
1590 .. _v6.130.9:
1591
1592 --------------------
1593 6.130.9 - 2025-04-06
1594 --------------------
1595
1596 When reporting the always-failing, never-passing lines from the |Phase.explain| phase, we now sort the reported lines so that local code shows up first, then third-party library code, then standard library code.
1597
1598 .. _v6.130.8:
1599
1600 --------------------
1601 6.130.8 - 2025-04-02
1602 --------------------
1603
1604 Improves the documentation of |settings.Verbosity| objects.
1605
1606 .. _v6.130.7:
1607
1608 --------------------
1609 6.130.7 - 2025-04-02
1610 --------------------
1611
1612 Rename internal variables for clarity.
1613
1614 .. _v6.130.6:
1615
1616 --------------------
1617 6.130.6 - 2025-03-31
1618 --------------------
1619
1620 Update the documentation link in |HealthCheck| error messages to their new location in the documentation.
1621
1622 .. _v6.130.5:
1623
1624 --------------------
1625 6.130.5 - 2025-03-28
1626 --------------------
1627
1628 Improve our internal type hints.
1629
1630 .. _v6.130.4:
1631
1632 --------------------
1633 6.130.4 - 2025-03-25
1634 --------------------
1635
1636 Improve an additional interaction between the :pypi:`hypothesis-crosshair`
1637 :ref:`backend <alternative-backends>` and :ref:`our observability tools <observability>`.
1638
1639 .. _v6.130.3:
1640
1641 --------------------
1642 6.130.3 - 2025-03-24
1643 --------------------
1644
1645 This patch improves the interaction between the :pypi:`hypothesis-crosshair`
1646 :ref:`backend <alternative-backends>` and :ref:`our observability tools <observability>`.
1647
1648 .. _v6.130.2:
1649
1650 --------------------
1651 6.130.2 - 2025-03-22
1652 --------------------
1653
1654 Fix an issue with realizing symbolic values provided by :ref:`alternative backends <alternative-backends>` when Hypothesis encounters an internal error in its engine.
1655
1656 .. _v6.130.1:
1657
1658 --------------------
1659 6.130.1 - 2025-03-22
1660 --------------------
1661
1662 Improve the documentation for some strategies, including |st.composite| and |st.data|.
1663
1664 .. _v6.130.0:
1665
1666 --------------------
1667 6.130.0 - 2025-03-21
1668 --------------------
1669
1670 Nesting :func:`@given <hypothesis.given>` inside of :func:`@given <hypothesis.given>` is now a |HealthCheck| failure. Nesting :func:`@given <hypothesis.given>` results in quadratic generation and shrinking behavior, and can usually be more cleanly expressed by replacing the inner function with a :func:`~hypothesis.strategies.data` parameter on the outer given. For more details, see :obj:`~hypothesis.HealthCheck.nested_given`. (:issue:`4167`)
1671
1672 .. _v6.129.5:
1673
1674 --------------------
1675 6.129.5 - 2025-03-21
1676 --------------------
1677
1678 Fixes an internal error when certain :ref:`alternative backends <alternative-backends>` find a failure on their very first generated example.
1679
1680 .. _v6.129.4:
1681
1682 --------------------
1683 6.129.4 - 2025-03-18
1684 --------------------
1685
1686 :func:`~hypothesis.strategies.nothing` is now typed as ``SearchStrategy[Never]``, because no value can ever be drawn from it. This may help type checkers statically determine that some code is not reachable.
1687
1688 .. _v6.129.3:
1689
1690 --------------------
1691 6.129.3 - 2025-03-16
1692 --------------------
1693
1694 This patch improves the string representation of :func:`~hypothesis.strategies.fixed_dictionaries`.
1695
1696 .. _v6.129.2:
1697
1698 --------------------
1699 6.129.2 - 2025-03-14
1700 --------------------
1701
1702 Improve how the shrinker checks for unnecessary work, leading to 10% less time spent shrinking on average, with no reduction in quality.
1703
1704 .. _v6.129.1:
1705
1706 --------------------
1707 6.129.1 - 2025-03-13
1708 --------------------
1709
1710 :func:`~hypothesis.strategies.randoms` no longer produces ``1.0``, matching
1711 the exclusive upper bound of :obj:`random.Random.random` (:issue:`4297`).
1712
1713 .. _v6.129.0:
1714
1715 --------------------
1716 6.129.0 - 2025-03-11
1717 --------------------
1718
1719 This release adds a ``"hypothesis-urandom"`` :ref:`backend <alternative-backends>`, which draws randomness from ``/dev/urandom`` instead of Python's PRNG. This is useful for users of `Antithesis <https://antithesis.com/>`_ who also have Hypothesis tests, allowing Antithesis mutation of ``/dev/urandom`` to drive Hypothesis generation. We expect it to be strictly slower than the default backend for everyone else.
1720
1721 It can be enabled with ``@settings(backend="hypothesis-urandom")``.
1722
1723 .. _v6.128.3:
1724
1725 --------------------
1726 6.128.3 - 2025-03-11
1727 --------------------
1728
1729 For strategies which draw make recursive draws, including :func:`~hypothesis.strategies.recursive` and :func:`~hypothesis.strategies.deferred`, we now generate examples with duplicated subtrees more often. This tends to uncover interesting behavior in tests.
1730
1731 For instance, we might now generate a tree like this more often (though the details depend on the strategy):
1732
1733 .. code-block:: none
1734
1735 ┌─────┐
1736 ┌──────┤ a ├──────┐
1737 │ └─────┘ │
1738 ┌──┴──┐ ┌──┴──┐
1739 │ b │ │ a │
1740 └──┬──┘ └──┬──┘
1741 ┌────┴────┐ ┌────┴────┐
1742 ┌──┴──┐ ┌──┴──┐ ┌──┴──┐ ┌──┴──┐
1743 │ c │ │ d │ │ b │ │ ... │
1744 └─────┘ └─────┘ └──┬──┘ └─────┘
1745 ┌────┴────┐
1746 ┌──┴──┐ ┌──┴──┐
1747 │ c │ │ d │
1748 └─────┘ └─────┘
1749
1750 .. _v6.128.2:
1751
1752 --------------------
1753 6.128.2 - 2025-03-10
1754 --------------------
1755
1756 Improves input validation for several strategies in our :ref:`pandas extra
1757 <hypothesis-pandas>`, so that they raise a helpful ``InvalidArgument`` rather
1758 than ``OverflowError``.
1759
1760 Discovered by our recent :ref:`string generation upgrade <v6.128.0>`.
1761
1762 .. _v6.128.1:
1763
1764 --------------------
1765 6.128.1 - 2025-03-09
1766 --------------------
1767
1768 Rename a few internal classes for clarity.
1769
1770 .. _v6.128.0:
1771
1772 --------------------
1773 6.128.0 - 2025-03-09
1774 --------------------
1775
1776 :func:`~hypothesis.strategies.text` now occasionally generates from a preselected list of strings which are likely to find bugs. These include ligatures, right-to-left and top-to-bottom text, emojis, emoji modifiers, strings like ``"Infinity"``, ``"None"``, and ``"FALSE"``, and other interesting things. This is especially useful when testing the full unicode range, where the search space is too large for uniform sampling to be very effective.
1777
1778 Of course, examples generated this way shrink just like they normally would. It was always possible for Hypothesis to generate these strings; it is just more likely after this change. From the outside, it is as if Hypothesis generated the example completely randomly.
1779
1780 Many thanks to the `Big List of Naughty Strings <https://github.com/minimaxir/big-list-of-naughty-strings>`_, `Text Rendering Hates You <https://faultlore.com/blah/text-hates-you/>`_, and `Text Editing Hates You Too <https://lord.io/text-editing-hates-you-too/>`_ for forming the basis of this list.
1781
1782 .. _v6.127.9:
1783
1784 --------------------
1785 6.127.9 - 2025-03-06
1786 --------------------
1787
1788 We now provide a better string representation for :func:`~hypothesis.strategies.one_of` strategies, by flattening consecutive ``|`` combinations. For instance:
1789
1790 .. code-block:: pycon
1791
1792 >>> st.integers() | st.text() | st.booleans()
1793 # previously: one_of(one_of(integers(), text()), booleans())
1794 one_of(integers(), text(), booleans())
1795
1796 Explicit calls to :func:`~hypothesis.strategies.one_of` remain unflattened, in order to make tracking down complicated :func:`~hypothesis.strategies.one_of` constructions easier:
1797
1798 .. code-block:: pycon
1799
1800 >>> st.one_of(st.integers(), st.one_of(st.text(), st.booleans()))
1801 one_of(integers(), one_of(text(), booleans()))
1802
1803 We print ``one_of`` in reprs (rather than ``integers() | text() | ...``) for consistency with reprs containing ``.filter`` or ``.map`` calls, which uses the full ``one_of`` to avoid ambiguity.
1804
1805 .. _v6.127.8:
1806
1807 --------------------
1808 6.127.8 - 2025-03-06
1809 --------------------
1810
1811 This patch improves shrinking behavior for values from :func:`~hypothesis.strategies.text` and :func:`~hypothesis.strategies.binary` which contain duplicate elements, like ``"zzzabc"``. It also improves shrinking for bugs which require the same character to be drawn from two different :func:`~hypothesis.strategies.text` strategies to trigger.
1812
1813 .. _v6.127.7:
1814
1815 --------------------
1816 6.127.7 - 2025-03-05
1817 --------------------
1818
1819 Fix a type-hinting regression from :ref:`version 6.125.1 <v6.125.1>`, where we would no longer guarantee the type of the argument to ``.filter`` predicates (:issue:`4269`).
1820
1821 .. code-block:: python
1822
1823 # x was previously Unknown, but is now correctly guaranteed to be int
1824 st.integers().filter(lambda x: x > 0)
1825
1826 .. _v6.127.6:
1827
1828 --------------------
1829 6.127.6 - 2025-03-04
1830 --------------------
1831
1832 This patch tweaks the performance of |Phase.target|, avoiding aborting some test cases when it would be better to finish generating them.
1833
1834 .. _v6.127.5:
1835
1836 --------------------
1837 6.127.5 - 2025-03-03
1838 --------------------
1839
1840 This patch fixes a bug where :func:`~hypothesis.strategies.from_type` would error on certain types involving :class:`~python:typing.Protocol` (:issue:`4194`).
1841
1842 .. _v6.127.4:
1843
1844 --------------------
1845 6.127.4 - 2025-03-02
1846 --------------------
1847
1848 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
1849 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
1850
1851 .. _v6.127.3:
1852
1853 --------------------
1854 6.127.3 - 2025-02-28
1855 --------------------
1856
1857 Improve shrinking of non-standard NaN float values (:issue:`4277`).
1858
1859 .. _v6.127.2:
1860
1861 --------------------
1862 6.127.2 - 2025-02-24
1863 --------------------
1864
1865 Adjust type hints for the pub-sub database implementation in :ref:`version 6.126.0 <v6.126.0>`, and remove a remnant debug print in its implementation.
1866
1867 .. _v6.127.1:
1868
1869 --------------------
1870 6.127.1 - 2025-02-23
1871 --------------------
1872
1873 Improve the clarity of printing counterexamples in :ref:`stateful testing <stateful>`, by avoiding confusing :class:`~hypothesis.stateful.Bundle` references with equivalent values drawn from a regular strategy.
1874
1875 For example, we now print:
1876
1877 .. code-block:: python
1878
1879 a_0 = state.add_to_bundle(a=0)
1880 state.unrelated(value=0)
1881
1882 instead of
1883
1884 .. code-block:: python
1885
1886 a_0 = state.add_to_bundle(a=0)
1887 state.unrelated(value=a_0)
1888
1889 if the ``unrelated`` rule draws from a regular strategy such as :func:`~hypothesis.strategies.integers` instead of the ``a`` bundle.
1890
1891 .. _v6.127.0:
1892
1893 --------------------
1894 6.127.0 - 2025-02-23
1895 --------------------
1896
1897 This releases adds support for type aliases created with the :py:keyword:`type` statement (new in python 3.12) to :func:`~hypothesis.strategies.from_type` and :func:`~hypothesis.strategies.register_type_strategy`.
1898
1899 .. _v6.126.0:
1900
1901 --------------------
1902 6.126.0 - 2025-02-18
1903 --------------------
1904
1905 The :ref:`Hypothesis database <database>` now supports a pub-sub interface to efficiently listen for changes in the database, via ``.add_listener`` and ``.remove_listener``. While all databases that ship with Hypothesis support this interface, implementing it is not required for custom database subclasses. Hypothesis will warn when trying to listen on a database without support.
1906
1907 This feature is currently only used downstream in `hypofuzz <https://github.com/zac-hd/hypofuzz>`_.
1908
1909 .. _v6.125.3:
1910
1911 --------------------
1912 6.125.3 - 2025-02-11
1913 --------------------
1914
1915 Improves sharing of some internal cache behavior.
1916
1917 .. _v6.125.2:
1918
1919 --------------------
1920 6.125.2 - 2025-02-06
1921 --------------------
1922
1923 Optimize performance (improves speed by ~5%) and clarify the wording in an error message.
1924
1925 .. _v6.125.1:
1926
1927 --------------------
1928 6.125.1 - 2025-02-03
1929 --------------------
1930
1931 Fixes a bug since around :ref:`version 6.124.4 <v6.124.4>` where we might have generated ``-0.0`` for ``st.floats(min_value=0.0)``, which is unsound.
1932
1933 .. _v6.125.0:
1934
1935 --------------------
1936 6.125.0 - 2025-02-03
1937 --------------------
1938
1939 Add 2024.12 to the list of recognized Array API versions in
1940 ``hypothesis.extra.array_api``.
1941
1942 .. _v6.124.9:
1943
1944 --------------------
1945 6.124.9 - 2025-02-01
1946 --------------------
1947
1948 Registration of experimental :ref:`alternative-backends` is now done via ``hypothesis.internal.conjecture.providers.AVAILABLE_PROVIDERS`` instead of ``hypothesis.internal.conjecture.data.AVAILABLE_PROVIDERS``.
1949
1950 .. _v6.124.8:
1951
1952 --------------------
1953 6.124.8 - 2025-02-01
1954 --------------------
1955
1956 Refactor some internals for better type hinting.
1957
1958 .. _v6.124.7:
1959
1960 --------------------
1961 6.124.7 - 2025-01-25
1962 --------------------
1963
1964 Internal renamings.
1965
1966 .. _v6.124.6:
1967
1968 --------------------
1969 6.124.6 - 2025-01-25
1970 --------------------
1971
1972 More work on internal type hints.
1973
1974 .. _v6.124.5:
1975
1976 --------------------
1977 6.124.5 - 2025-01-25
1978 --------------------
1979
1980 Internal refactoring to make some stateful internals easier to access.
1981
1982 .. _v6.124.4:
1983
1984 --------------------
1985 6.124.4 - 2025-01-25
1986 --------------------
1987
1988 Refactoring of our internal input generation. This shouldn't lead to any changes in the distribution of test inputs. If you notice any, please open an issue!
1989
1990 .. _v6.124.3:
1991
1992 --------------------
1993 6.124.3 - 2025-01-24
1994 --------------------
1995
1996 Some Hypothesis internals now use the number of choices as a yardstick of input size, rather than the entropy consumed by those choices. We don't expect this to cause significant behavioral changes.
1997
1998 .. _v6.124.2:
1999
2000 --------------------
2001 6.124.2 - 2025-01-21
2002 --------------------
2003
2004 Improves our internal caching logic for test cases.
2005
2006 .. _v6.124.1:
2007
2008 --------------------
2009 6.124.1 - 2025-01-18
2010 --------------------
2011
2012 :ref:`fuzz_one_input <fuzz_one_input>` is now implemented using an :ref:`alternative backend <alternative-backends>`. This brings the interpretation of the fuzzer-provided bytestring closer to the fuzzer mutations, allowing the mutations to work more reliably. We hope to use this backend functionality to improve fuzzing integration (e.g. `atheris issue #20 <https://github.com/google/atheris/issues/20>`__) in the future!
2013
2014 .. _v6.124.0:
2015
2016 --------------------
2017 6.124.0 - 2025-01-16
2018 --------------------
2019
2020 The :ref:`Hypothesis example database <database>` now uses a new internal format to store examples. This new format is not compatible with the previous format, so stored entries will not carry over.
2021
2022 The database is best thought of as a cache that may be invalidated at times. Instead of relying on it for correctness, we recommend using :obj:`@example <hypothesis.example>` to specify explicit examples. When using databases across environments (such as connecting a :class:`~hypothesis.database.GitHubArtifactDatabase` database in CI to your local environment), we recommend using the same version of Hypothesis for each where possible, for maximum reproducibility.
2023
2024 .. _v6.123.17:
2025
2026 ---------------------
2027 6.123.17 - 2025-01-13
2028 ---------------------
2029
2030 This patch improves certain corner cases for reporting of flaky errors
2031 (:issue:`4183` and :issue:`4228`).
2032
2033 .. _v6.123.16:
2034
2035 ---------------------
2036 6.123.16 - 2025-01-13
2037 ---------------------
2038
2039 Improves an edge case in one of our integer and float shrinking passes.
2040
2041 .. _v6.123.15:
2042
2043 ---------------------
2044 6.123.15 - 2025-01-11
2045 ---------------------
2046
2047 Improves one of our shrinking passes for integers which require a constant relative difference to trigger the bug.
2048
2049 .. _v6.123.14:
2050
2051 ---------------------
2052 6.123.14 - 2025-01-11
2053 ---------------------
2054
2055 Avoid realizing symbolic values from :ref:`alternative-backends` when |Verbosity| is ``verbose`` or higher.
2056
2057 .. _v6.123.13:
2058
2059 ---------------------
2060 6.123.13 - 2025-01-09
2061 ---------------------
2062
2063 More internal code refactoring.
2064
2065 .. _v6.123.12:
2066
2067 ---------------------
2068 6.123.12 - 2025-01-09
2069 ---------------------
2070
2071 :class:`~hypothesis.database.DirectoryBasedExampleDatabase` now creates files representing database entries atomically, avoiding a very brief intermediary state where a file could be created but not yet written to.
2072
2073 .. _v6.123.11:
2074
2075 ---------------------
2076 6.123.11 - 2025-01-09
2077 ---------------------
2078
2079 Internal code refactoring.
2080
2081 .. _v6.123.10:
2082
2083 ---------------------
2084 6.123.10 - 2025-01-09
2085 ---------------------
2086
2087 Fixes a bug caused by :ref:`alternative backends <alternative-backends>` raising ``hypothesis.errors.BackendCannotProceed`` in certain cases.
2088
2089 .. _v6.123.9:
2090
2091 --------------------
2092 6.123.9 - 2025-01-08
2093 --------------------
2094
2095 Add internal type hints to our pretty printer.
2096
2097 .. _v6.123.8:
2098
2099 --------------------
2100 6.123.8 - 2025-01-08
2101 --------------------
2102
2103 The shrinker contains a pass aimed at integers which are required to sum to a value. This patch extends that pass to floats as well.
2104
2105 .. _v6.123.7:
2106
2107 --------------------
2108 6.123.7 - 2025-01-07
2109 --------------------
2110
2111 Internal type hint additions and refactorings.
2112
2113 .. _v6.123.6:
2114
2115 --------------------
2116 6.123.6 - 2025-01-07
2117 --------------------
2118
2119 :func:`@reproduce_failure() <hypothesis.reproduce_failure>` now uses a newer internal interface to represent failures. As a reminder, this representation is not intended to be stable across versions or with respect to changes in the test.
2120
2121 .. _v6.123.5:
2122
2123 --------------------
2124 6.123.5 - 2025-01-07
2125 --------------------
2126
2127 Internal code refactoring for the typed choice sequence (:issue:`3921`). May have some neutral effect on shrinking.
2128
2129 .. _v6.123.4:
2130
2131 --------------------
2132 6.123.4 - 2025-01-06
2133 --------------------
2134
2135 This patch improves shrinking involving long strings or byte sequences whose value is not relevant to the failure.
2136
2137 .. _v6.123.3:
2138
2139 --------------------
2140 6.123.3 - 2025-01-06
2141 --------------------
2142
2143 This release further improves shrinking of strategies using :func:`~hypothesis.strategies.one_of`,
2144 allowing the shrinker to more reliably move between branches of the strategy.
2145
2146 .. _v6.123.2:
2147
2148 --------------------
2149 6.123.2 - 2024-12-27
2150 --------------------
2151
2152 The shrinker now uses the typed choice sequence (:issue:`3921`) when ordering failing examples. As a result, Hypothesis may now report a different minimal failing example for some tests. We expect most cases to remain unchanged.
2153
2154 .. _v6.123.1:
2155
2156 --------------------
2157 6.123.1 - 2024-12-24
2158 --------------------
2159
2160 Our pytest plugin now emits a warning if you set Pytest's ``norecursedirs``
2161 config option in such a way that the ``.hypothesis`` directory would be
2162 searched for tests. This reliably indicates that you've made a mistake
2163 which slows down test collection, usually assuming that your configuration
2164 extends the set of ignored patterns when it actually replaces them.
2165 (:issue:`4200`)
2166
2167 .. _v6.123.0:
2168
2169 --------------------
2170 6.123.0 - 2024-12-23
2171 --------------------
2172
2173 :func:`~hypothesis.strategies.from_type` can now handle constructors with
2174 required positional-only arguments if they have type annotations. Previously,
2175 we only passed arguments by keyword.
2176
2177 .. _v6.122.7:
2178
2179 --------------------
2180 6.122.7 - 2024-12-23
2181 --------------------
2182
2183 This patch lays some groundwork for migrating our internal representation to the typed choice sequence (:issue:`3921`)
2184
2185 .. _v6.122.6:
2186
2187 --------------------
2188 6.122.6 - 2024-12-21
2189 --------------------
2190
2191 This patch cleans up some internal code around clamping floats.
2192
2193 .. _v6.122.5:
2194
2195 --------------------
2196 6.122.5 - 2024-12-20
2197 --------------------
2198
2199 This release improves shrinking in some cases, especially for strategies using :func:`~hypothesis.strategies.one_of`.
2200 This will typically improve shrinking speed and may in some cases improve the end result.
2201
2202 .. _v6.122.4:
2203
2204 --------------------
2205 6.122.4 - 2024-12-19
2206 --------------------
2207
2208 This patch improves generation performance for the provisional :func:`~hypothesis.provisional.domains` strategy, including its derivative strategies :func:`~hypothesis.provisional.urls` and :func:`~hypothesis.strategies.emails`.
2209
2210 .. _v6.122.3:
2211
2212 --------------------
2213 6.122.3 - 2024-12-08
2214 --------------------
2215
2216 This patch improves our error and warning messages.
2217
2218 - Add a warning for ``st.text("ascii")`` - you probably meant ``st.text(st.characters(codec="ascii"))``. Similarly for ``"utf-8"``.
2219 - Recommend remedies in the error message of ``Unsatisfiable``.
2220 - When ``@given`` errors because it was given an extra keyword argument, and the keyword matches a setting name like ``max_examples``, recommend ``@settings(max_examples=...)`` instead.
2221
2222 .. _v6.122.2:
2223
2224 --------------------
2225 6.122.2 - 2024-12-08
2226 --------------------
2227
2228 This patch updates some outdated external links in our documentation.
2229
2230 .. _v6.122.1:
2231
2232 --------------------
2233 6.122.1 - 2024-12-01
2234 --------------------
2235
2236 Fix :func:`~hypothesis.strategies.from_type`
2237 on :class:`collections.abc.Callable` returning ``None``.
2238
2239 .. _v6.122.0:
2240
2241 --------------------
2242 6.122.0 - 2024-11-29
2243 --------------------
2244
2245 This release adds ``.span_start()`` and ``.span_end()`` methods
2246 to our internal ``PrimitiveProvider`` interface, for use by
2247 :ref:`alternative-backends`.
2248
2249 .. _v6.121.2:
2250
2251 --------------------
2252 6.121.2 - 2024-11-29
2253 --------------------
2254
2255 This patch updates our autoformatting tools, improving our code style without any API changes.
2256
2257 .. _v6.121.1:
2258
2259 --------------------
2260 6.121.1 - 2024-11-29
2261 --------------------
2262
2263 This release brings back the old representation of :class:`hypothesis.stateful.Bundle`, reverting most changes of `PR #4124 <https://github.com/HypothesisWorks/hypothesis/pull/4124>`_.
2264
2265 .. _v6.121.0:
2266
2267 --------------------
2268 6.121.0 - 2024-11-28
2269 --------------------
2270
2271 This release adds :class:`~hypothesis.database.BackgroundWriteDatabase`, a new database backend which defers writes on the wrapped database to a background thread. This allows for low-overhead writes in performance-critical environments like :ref:`fuzz_one_input <fuzz_one_input>`.
2272
2273 .. _v6.120.0:
2274
2275 --------------------
2276 6.120.0 - 2024-11-27
2277 --------------------
2278
2279 * This release changes our input distribution for low ``max_examples``. Previously, we capped the size of inputs when generating at least the first 10 inputs, with the reasoning that early inputs to a property should be small. However, this meant properties with ``max_examples=10`` would consistent entirely of small inputs. This patch removes the hard lower bound so that inputs to these properties are more representative of the input space.
2280 * When a user requests an interactive input via ``strategy.example``, we generate and cache a batch of 100 inputs, returning the first one. This can be expensive for large strategies or when only a few examples are needed. This release improves the speed of ``strategy.example`` by lowering the batch size to 10.
2281
2282 .. _v6.119.4:
2283
2284 --------------------
2285 6.119.4 - 2024-11-22
2286 --------------------
2287
2288 This patch fixes a bug since :ref:`v6.99.13` where only interactively-generated values (via ``data.draw``) would be reported in the ``arguments`` field of our :ref:`observability output <observability>`. Now, all values are reported.
2289
2290 .. _v6.119.3:
2291
2292 --------------------
2293 6.119.3 - 2024-11-17
2294 --------------------
2295
2296 Hypothesis collects coverage information during the |Phase.shrink| and |Phase.explain| phases in order to show a more informative error message. On 3.12+, this uses :mod:`sys.monitoring`. This patch improves the performance of coverage collection on 3.12+ by disabling events we don't need.
2297
2298 .. _v6.119.2:
2299
2300 --------------------
2301 6.119.2 - 2024-11-17
2302 --------------------
2303
2304 This patch refactors some internals to prepare for future work using our IR (:issue:`3921`).
2305
2306 .. _v6.119.1:
2307
2308 --------------------
2309 6.119.1 - 2024-11-15
2310 --------------------
2311
2312 This patch migrates some more internals (around generating novel inputs) to the IR layer (:issue:`3921`).
2313
2314 .. _v6.119.0:
2315
2316 --------------------
2317 6.119.0 - 2024-11-15
2318 --------------------
2319
2320 This release improves Hypothesis' handling of ExceptionGroup - it's now able to detect marker detections if they're inside a group and attempts to resolve them. Note that this handling is still a work in progress and might not handle edge cases optimally. Please open issues if you encounter any problems or unexpected behavior with it.
2321
2322 .. _v6.118.9:
2323
2324 --------------------
2325 6.118.9 - 2024-11-15
2326 --------------------
2327
2328 Internal refactorings in preparation for upcoming changes.
2329
2330 .. _v6.118.8:
2331
2332 --------------------
2333 6.118.8 - 2024-11-12
2334 --------------------
2335
2336 Internal renamings.
2337
2338 .. _v6.118.7:
2339
2340 --------------------
2341 6.118.7 - 2024-11-10
2342 --------------------
2343
2344 This patch removes some ``# type: ignore`` comments following a :pypi:`mypy` update.
2345
2346 .. _v6.118.6:
2347
2348 --------------------
2349 6.118.6 - 2024-11-10
2350 --------------------
2351
2352 When Hypothesis replays examples from its test database that it knows were previously fully shrunk it will no longer try to shrink them again.
2353
2354 This should significantly speed up development workflows for slow tests, as the shrinking could contribute a significant delay when rerunning the tests.
2355
2356 In some rare cases this may cause minor reductions in example quality. This was considered an acceptable tradeoff for the improved test runtime.
2357
2358 .. _v6.118.5:
2359
2360 --------------------
2361 6.118.5 - 2024-11-10
2362 --------------------
2363
2364 This patch avoids computing some string representations we won't need,
2365 giving a small speedup (part of :issue:`4139`).
2366
2367 .. _v6.118.4:
2368
2369 --------------------
2370 6.118.4 - 2024-11-10
2371 --------------------
2372
2373 This patch migrates the optimisation algorithm for :ref:`targeted property-based testing <targeted>` to our IR layer (:issue:`3921`). This should result in moderately different (and hopefully improved) exploration behavior in tests which use :func:`hypothesis.target`.
2374
2375 .. _v6.118.3:
2376
2377 --------------------
2378 6.118.3 - 2024-11-10
2379 --------------------
2380
2381 This patch adds more type hints to internal Hypothesis code.
2382
2383 .. _v6.118.2:
2384
2385 --------------------
2386 6.118.2 - 2024-11-09
2387 --------------------
2388
2389 This patch migrates the |Phase.explain| phase to our IR layer (:issue:`3921`). This should improve both its speed and precision.
2390
2391 .. _v6.118.1:
2392
2393 --------------------
2394 6.118.1 - 2024-11-09
2395 --------------------
2396
2397 This patch updates some internals around how we determine an input is too large to finish generating.
2398
2399 .. _v6.118.0:
2400
2401 --------------------
2402 6.118.0 - 2024-11-08
2403 --------------------
2404
2405 The :func:`~hypothesis.provisional.urls` strategy no longer generates
2406 URLs where the port number is 0.
2407
2408 This change is motivated by the idea that the generated URLs should, at least in
2409 theory, be possible to fetch. The port number 0 is special; if a server binds to
2410 port 0, the kernel will allocate an unused, and non-zero, port instead. That
2411 means that it's not possible for a server to actually be listening on port 0.
2412 This motivation is briefly described in the documentation for
2413 :func:`~hypothesis.provisional.urls`.
2414
2415 Thanks to @gmacon for fixing :issue:`4157`!
2416
2417 .. _v6.117.0:
2418
2419 --------------------
2420 6.117.0 - 2024-11-07
2421 --------------------
2422
2423 This changes the behaviour of settings profiles so that if you reregister the currently loaded profile it will automatically reload it. Previously you would have had to load it again.
2424
2425 In particular this means that if you register a "ci" profile, it will automatically be used when Hypothesis detects you are running on CI.
2426
2427 .. _v6.116.0:
2428
2429 --------------------
2430 6.116.0 - 2024-11-01
2431 --------------------
2432
2433 Hypothesis now detects if it is running on a CI server and provides better default settings for running on CI in this case.
2434
2435 .. _v6.115.6:
2436
2437 --------------------
2438 6.115.6 - 2024-10-30
2439 --------------------
2440
2441 This patch changes the priority order of pretty printing logic so that a user
2442 provided pretty printing method will always be used in preference to e.g.
2443 printing it like a dataclass.
2444
2445 .. _v6.115.5:
2446
2447 --------------------
2448 6.115.5 - 2024-10-23
2449 --------------------
2450
2451 This patch restores diversity to the outputs of
2452 :func:`from_type(type) <hypothesis.strategies.from_type>` (:issue:`4144`).
2453
2454 .. _v6.115.4:
2455
2456 --------------------
2457 6.115.4 - 2024-10-23
2458 --------------------
2459
2460 This release improves pretty printing of nested classes to include the outer class name in their printed representation.
2461
2462 .. _v6.115.3:
2463
2464 --------------------
2465 6.115.3 - 2024-10-16
2466 --------------------
2467
2468 This patch fixes a regression from :ref:`version 6.115.2 <v6.115.2>` where generating values from :func:`~hypothesis.strategies.integers` with certain values for ``min_value`` and ``max_value`` would error.
2469
2470 .. _v6.115.2:
2471
2472 --------------------
2473 6.115.2 - 2024-10-14
2474 --------------------
2475
2476 This release improves integer shrinking by folding the endpoint upweighting for :func:`~hypothesis.strategies.integers` into the ``weights`` parameter of our IR (:issue:`3921`).
2477
2478 If you maintain an alternative backend as part of our (for now explicitly unstable) :ref:`alternative-backends`, this release changes the type of the ``weights`` parameter to ``draw_integer`` and may be a breaking change for you.
2479
2480 .. _v6.115.1:
2481
2482 --------------------
2483 6.115.1 - 2024-10-14
2484 --------------------
2485
2486 This patch improves the performance of :func:`~hypothesis.strategies.from_type` with
2487 `pydantic.types.condate <https://docs.pydantic.dev/latest/api/types/#pydantic.types.condate>`__
2488 (:issue:`4000`).
2489
2490 .. _v6.115.0:
2491
2492 --------------------
2493 6.115.0 - 2024-10-12
2494 --------------------
2495
2496 This improves the formatting of dataclasses and attrs classes when printing
2497 falsifying examples.
2498
2499 .. _v6.114.1:
2500
2501 --------------------
2502 6.114.1 - 2024-10-10
2503 --------------------
2504
2505 This patch upgrades remaining type annotations to Python 3.9 syntax.
2506
2507 .. _v6.114.0:
2508
2509 --------------------
2510 6.114.0 - 2024-10-09
2511 --------------------
2512
2513 This release drops support for Python 3.8, `which reached end of life on
2514 2024-10-07 <https://devguide.python.org/versions/>`__.
2515
2516 .. _v6.113.0:
2517
2518 --------------------
2519 6.113.0 - 2024-10-09
2520 --------------------
2521
2522 This release adds ``hypothesis.errors.BackendCannotProceed``, an unstable API
2523 for use by :ref:`alternative-backends`.
2524
2525 .. _v6.112.5:
2526
2527 --------------------
2528 6.112.5 - 2024-10-08
2529 --------------------
2530
2531 This release fixes a regression where :class:`hypothesis.stateful.Bundle` did not work properly with |.flatmap| functionality (:issue:`4128`).
2532
2533 .. _v6.112.4:
2534
2535 --------------------
2536 6.112.4 - 2024-10-06
2537 --------------------
2538
2539 This patch tweaks the paths in ``@example(...)`` patches, so that
2540 both ``git apply`` and ``patch`` will work by default.
2541
2542 .. _v6.112.3:
2543
2544 --------------------
2545 6.112.3 - 2024-10-05
2546 --------------------
2547
2548 This release refactors internals of :class:`hypothesis.stateful.Bundle` to have a more consistent representation internally.
2549
2550 .. _v6.112.2:
2551
2552 --------------------
2553 6.112.2 - 2024-09-29
2554 --------------------
2555
2556 This patch fixes an internal error when the ``__context__``
2557 attribute of a raised exception leads to a cycle (:issue:`4115`).
2558
2559 .. _v6.112.1:
2560
2561 --------------------
2562 6.112.1 - 2024-09-13
2563 --------------------
2564
2565 This patch removes a now-incorrect internal assertion about numpy's typing after recent numpy changes (currently only in numpy's nightly release).
2566
2567 .. _v6.112.0:
2568
2569 --------------------
2570 6.112.0 - 2024-09-05
2571 --------------------
2572
2573 This release adds support for variable-width bytes in our IR layer (:issue:`3921`), which should mean improved performance anywhere you use :func:`~hypothesis.strategies.binary`. If you maintain an alternative backend as part of our (for now explicitly unstable) :ref:`alternative-backends`, this release changes the ``draw_*`` interface and may be a breaking change for you.
2574
2575 .. _v6.111.2:
2576
2577 --------------------
2578 6.111.2 - 2024-08-24
2579 --------------------
2580
2581 This patch contains some internal code cleanup. There is no user-visible change.
2582
2583 .. _v6.111.1:
2584
2585 --------------------
2586 6.111.1 - 2024-08-15
2587 --------------------
2588
2589 This patch improves shrinking in cases involving 'slips' from one strategy to another. Highly composite strategies are the most likely to benefit from this change.
2590
2591 This patch also reduces the range of :class:`python:datetime.datetime` generated by :func:`~hypothesis.extra.django.from_model` in order to avoid https://code.djangoproject.com/ticket/35683.
2592
2593 .. _v6.111.0:
2594
2595 --------------------
2596 6.111.0 - 2024-08-11
2597 --------------------
2598
2599 :ref:`alternative-backends` can now implement ``.observe_test_case()``
2600 and ``observe_information_message()`` methods, to record backend-specific
2601 metadata and messages in our :ref:`observability output <observability>`
2602 (:issue:`3845` and `hypothesis-crosshair#22
2603 <https://github.com/pschanely/hypothesis-crosshair/issues/22>`__).
2604
2605 .. _v6.110.2:
2606
2607 --------------------
2608 6.110.2 - 2024-08-11
2609 --------------------
2610
2611 Support ``__default__`` field of :obj:`~python:typing.TypeVar`
2612 and support the same from :pypi:`typing-extensions`
2613 in :func:`~hypothesis.strategies.from_type`.
2614
2615 .. _v6.110.1:
2616
2617 --------------------
2618 6.110.1 - 2024-08-08
2619 --------------------
2620
2621 Add better error message for :obj:`~python:typing.TypeIs` types
2622 in :func:`~hypothesis.strategies.from_type`.
2623
2624 .. _v6.110.0:
2625
2626 --------------------
2627 6.110.0 - 2024-08-07
2628 --------------------
2629
2630 Support :obj:`~python:typing.LiteralString`
2631 in :func:`~hypothesis.strategies.from_type`.
2632
2633 .. _v6.109.1:
2634
2635 --------------------
2636 6.109.1 - 2024-08-07
2637 --------------------
2638
2639 This patch makes progress towards adding type hints to our internal conjecture engine (:issue:`3074`).
2640
2641 .. _v6.109.0:
2642
2643 --------------------
2644 6.109.0 - 2024-08-07
2645 --------------------
2646
2647 This release allows using :obj:`~python:typing.Annotated`
2648 and :obj:`!ReadOnly` types
2649 for :obj:`~python:typing.TypedDict` value types
2650 with :func:`~hypothesis.strategies.from_type`.
2651
2652 .. _v6.108.10:
2653
2654 ---------------------
2655 6.108.10 - 2024-08-06
2656 ---------------------
2657
2658 This patch fixes compatibility with :pypi:`attrs==24.1.0 <attrs>`
2659 on the nightly build of CPython, 3.14.0 pre-alpha (:issue:`4067`).
2660
2661 .. _v6.108.9:
2662
2663 --------------------
2664 6.108.9 - 2024-08-05
2665 --------------------
2666
2667 This patch removes an assertion which was in fact possible in rare circumstances involving a small number of very large draws.
2668
2669 .. _v6.108.8:
2670
2671 --------------------
2672 6.108.8 - 2024-08-04
2673 --------------------
2674
2675 This patch improves our example generation performance by adjusting our internal cache implementation.
2676
2677 .. _v6.108.7:
2678
2679 --------------------
2680 6.108.7 - 2024-08-04
2681 --------------------
2682
2683 This patch improves our pretty-printer for unusual numbers.
2684
2685 - Signalling NaNs are now represented by using the :mod:`struct` module
2686 to show the exact value by converting from a hexadecimal integer
2687
2688 - CPython `limits integer-to-string conversions
2689 <https://docs.python.org/3/library/stdtypes.html#integer-string-conversion-length-limitation>`__
2690 to mitigate DDOS attacks. We now use hexadecimal for very large
2691 integers, and include underscore separators for integers with ten
2692 or more digits.
2693
2694 .. _v6.108.6:
2695
2696 --------------------
2697 6.108.6 - 2024-08-04
2698 --------------------
2699
2700 This patch improves generation speed in some cases by avoiding pretty-printing overhead for non-failing examples.
2701
2702 .. _v6.108.5:
2703
2704 --------------------
2705 6.108.5 - 2024-07-28
2706 --------------------
2707
2708 This patch fixes a rare internal error when using :func:`~hypothesis.strategies.integers` with a high number of examples and certain ``{min, max}_value`` parameters (:pull:`4059`).
2709
2710 .. _v6.108.4:
2711
2712 --------------------
2713 6.108.4 - 2024-07-22
2714 --------------------
2715
2716 This patch addresses the issue of hypothesis potentially accessing
2717 mocked ``time.perf_counter`` during test execution (:issue:`4051`).
2718
2719 .. _v6.108.3:
2720
2721 --------------------
2722 6.108.3 - 2024-07-22
2723 --------------------
2724
2725 Minor internal-only cleanups to some error-handling and reporting code.
2726
2727 .. _v6.108.2:
2728
2729 --------------------
2730 6.108.2 - 2024-07-15
2731 --------------------
2732
2733 This patch disables :func:`hypothesis.target` on alternative
2734 backends where it would not work.
2735
2736 .. _v6.108.1:
2737
2738 --------------------
2739 6.108.1 - 2024-07-14
2740 --------------------
2741
2742 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
2743 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
2744
2745 .. _v6.108.0:
2746
2747 --------------------
2748 6.108.0 - 2024-07-13
2749 --------------------
2750
2751 This patch changes most ``Flaky`` errors to use an :class:`ExceptionGroup`, which
2752 makes the representation of these errors easier to understand.
2753
2754 .. _v6.107.0:
2755
2756 --------------------
2757 6.107.0 - 2024-07-13
2758 --------------------
2759
2760 The ``alphabet=`` argument to :func:`~hypothesis.strategies.from_regex`
2761 now accepts unions of :func:`~hypothesis.strategies.characters` and
2762 :func:`~hypothesis.strategies.sampled_from` strategies, in addition to
2763 accepting each individually.
2764
2765 This patch also fixes a bug where ``text(...).filter(re.compile(...).match)``
2766 could generate non-matching instances if the regex pattern contained ``|``
2767 (:issue:`4008`).
2768
2769 .. _v6.106.1:
2770
2771 --------------------
2772 6.106.1 - 2024-07-12
2773 --------------------
2774
2775 This patch improves our pretty-printer (:issue:`4037`).
2776
2777 It also fixes the codemod for ``HealthCheck.all()`` from
2778 :ref:`version 6.72 <v6.72.0>`, which was instead trying to
2779 fix ``Healthcheck.all()`` - note the lower-case ``c``!
2780 Since our tests had the same typo, it all looked good...
2781 until :issue:`4030`.
2782
2783 .. _v6.106.0:
2784
2785 --------------------
2786 6.106.0 - 2024-07-12
2787 --------------------
2788
2789 This release improves support for unions of :pypi:`numpy` dtypes such as
2790 ``np.float64 | np.complex128`` in :func:`~hypothesis.strategies.from_type`
2791 and :func:`~hypothesis.extra.numpy.arrays` (:issue:`4041`).
2792
2793 .. _v6.105.2:
2794
2795 --------------------
2796 6.105.2 - 2024-07-12
2797 --------------------
2798
2799 This patch improves the reporting of certain flaky errors.
2800
2801 .. _v6.105.1:
2802
2803 --------------------
2804 6.105.1 - 2024-07-07
2805 --------------------
2806
2807 This patch iterates on our experimental support for alternative backends (:ref:`alternative-backends`). See :pull:`4029` for details.
2808
2809 .. _v6.105.0:
2810
2811 --------------------
2812 6.105.0 - 2024-07-04
2813 --------------------
2814
2815 This release improves support for Django 5.0, and drops support for end-of-life Django versions (< 4.2).
2816
2817 Thanks to Joshua Munn for this contribution.
2818
2819 .. _v6.104.4:
2820
2821 --------------------
2822 6.104.4 - 2024-07-04
2823 --------------------
2824
2825 Clean up internal cache implementation.
2826
2827 .. _v6.104.3:
2828
2829 --------------------
2830 6.104.3 - 2024-07-04
2831 --------------------
2832
2833 This patch updates our autoformatting tools, improving our code style without any API changes.
2834
2835 .. _v6.104.2:
2836
2837 --------------------
2838 6.104.2 - 2024-06-29
2839 --------------------
2840
2841 This patch fixes an issue when realizing symbolics with our experimental :obj:`~hypothesis.settings.backend` setting.
2842
2843 .. _v6.104.1:
2844
2845 --------------------
2846 6.104.1 - 2024-06-25
2847 --------------------
2848
2849 Improves internal test coverage.
2850
2851 .. _v6.104.0:
2852
2853 --------------------
2854 6.104.0 - 2024-06-24
2855 --------------------
2856
2857 This release adds strategies for Django's ``ModelChoiceField`` and
2858 ``ModelMultipleChoiceField`` (:issue:`4010`).
2859
2860 Thanks to Joshua Munn for this contribution.
2861
2862 .. _v6.103.5:
2863
2864 --------------------
2865 6.103.5 - 2024-06-24
2866 --------------------
2867
2868 Fixes and reinstates full coverage of internal tests, which was accidentally
2869 disabled in :pull:`3935` (:issue:`4003`).
2870
2871 .. _v6.103.4:
2872
2873 --------------------
2874 6.103.4 - 2024-06-24
2875 --------------------
2876
2877 This release prevents a race condition inside internal cache implementation.
2878
2879 .. _v6.103.3:
2880
2881 --------------------
2882 6.103.3 - 2024-06-24
2883 --------------------
2884
2885 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
2886 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
2887
2888 .. _v6.103.2:
2889
2890 --------------------
2891 6.103.2 - 2024-06-14
2892 --------------------
2893
2894 This patch improves our deduplication tracking across all strategies (:pull:`4007`). Hypothesis is now less likely to generate the same input twice.
2895
2896 .. _v6.103.1:
2897
2898 --------------------
2899 6.103.1 - 2024-06-05
2900 --------------------
2901
2902 Account for time spent in garbage collection during tests, to avoid
2903 flaky ``DeadlineExceeded`` errors as seen in :issue:`3975`.
2904
2905 Also fixes overcounting of stateful run times,
2906 a minor observability bug dating to :ref:`version 6.98.9 <v6.98.9>`
2907 (:pull:`3890`).
2908
2909 .. _v6.103.0:
2910
2911 --------------------
2912 6.103.0 - 2024-05-29
2913 --------------------
2914
2915 This release migrates the shrinker to our new internal representation, called the IR layer (:pull:`3962`). This improves the shrinker's performance in the majority of cases. For example, on the Hypothesis test suite, shrinking is a median of 1.38x faster.
2916
2917 It is possible this release regresses performance while shrinking certain strategies. If you encounter strategies which reliably shrink more slowly than they used to (or shrink slowly at all), please open an issue!
2918
2919 You can read more about the IR layer at :issue:`3921`.
2920
2921 .. _v6.102.6:
2922
2923 --------------------
2924 6.102.6 - 2024-05-23
2925 --------------------
2926
2927 This patch fixes one of our shrinking passes getting into a rare ``O(n)`` case instead of ``O(log(n))``.
2928
2929 .. _v6.102.5:
2930
2931 --------------------
2932 6.102.5 - 2024-05-22
2933 --------------------
2934
2935 This patch fixes some introspection errors new in Python 3.11.9 and
2936 3.13.0b1, for the Ghostwriter and :func:`~hypothesis.strategies.from_type`.
2937
2938 .. _v6.102.4:
2939
2940 --------------------
2941 6.102.4 - 2024-05-15
2942 --------------------
2943
2944 Internal developer documentation, no user-visible changes.
2945
2946 .. _v6.102.3:
2947
2948 --------------------
2949 6.102.3 - 2024-05-15
2950 --------------------
2951
2952 This patch improves our shrinking of unique collections, such as :func:`~hypothesis.strategies.dictionaries`,
2953 :func:`~hypothesis.strategies.sets`, and :func:`~hypothesis.strategies.lists` with ``unique=True``.
2954
2955 .. _v6.102.2:
2956
2957 --------------------
2958 6.102.2 - 2024-05-15
2959 --------------------
2960
2961 This patch fixes a rare internal error when generating very large elements from strategies (:issue:`3874`).
2962
2963 .. _v6.102.1:
2964
2965 --------------------
2966 6.102.1 - 2024-05-13
2967 --------------------
2968
2969 This patch fixes an overly strict internal type assertion.
2970
2971 .. _v6.102.0:
2972
2973 --------------------
2974 6.102.0 - 2024-05-13
2975 --------------------
2976
2977 This release improves our support for the :pypi:`annotated-types` iterable
2978 ``GroupedMetadata`` protocol. In order to treat the elements "as if they
2979 had been unpacked", if one such element is a :class:`~hypothesis.strategies.SearchStrategy`
2980 we now resolve to that strategy. Previously, we treated this as an unknown
2981 filter predicate.
2982
2983 We expect this to be useful for libraries implementing custom metadata -
2984 instead of requiring downstream integration, they can implement the protocol
2985 and yield a lazily-created strategy. Doing so only if Hypothesis is in
2986 :obj:`sys.modules` gives powerful integration with no runtime overhead
2987 or extra dependencies.
2988
2989 .. _v6.101.0:
2990
2991 --------------------
2992 6.101.0 - 2024-05-13
2993 --------------------
2994
2995 The :func:`~hypothesis.extra.django.from_model` function currently
2996 tries to create a strategy for :obj:`~django:django.db.models.AutoField`
2997 fields if they don't have :attr:`~django:django.db.models.Field.auto_created`
2998 set to `True`. The docs say it's supposed to skip all
2999 :obj:`~django:django.db.models.AutoField` fields, so this patch updates
3000 the code to do what the docs say (:issue:`3978`).
3001
3002 .. _v6.100.8:
3003
3004 --------------------
3005 6.100.8 - 2024-05-13
3006 --------------------
3007
3008 This patch adds some internal type annotations (:issue:`3074`).
3009 Thanks to Andrew Sansom for his contribution!
3010
3011 .. _v6.100.7:
3012
3013 --------------------
3014 6.100.7 - 2024-05-12
3015 --------------------
3016
3017 This patch fixes a rare internal error when using :func:`~hypothesis.strategies.integers` with a high ``max_examples`` setting (:issue:`3974`).
3018
3019 .. _v6.100.6:
3020
3021 --------------------
3022 6.100.6 - 2024-05-10
3023 --------------------
3024
3025 This patch improves our internal caching logic. We don't expect it to result in any performance improvements (yet!).
3026
3027 .. _v6.100.5:
3028
3029 --------------------
3030 6.100.5 - 2024-05-06
3031 --------------------
3032
3033 This patch turns off a check in :func:`~hypothesis.register_random` for possibly
3034 unreferenced RNG instances on the free-threaded build of CPython 3.13 because
3035 this check has a much higher false positive rate in the free-threaded build
3036 (:issue:`3965`).
3037
3038 Thanks to Nathan Goldbaum for this patch.
3039
3040 .. _v6.100.4:
3041
3042 --------------------
3043 6.100.4 - 2024-05-05
3044 --------------------
3045
3046 This patch turns off a warning for functions decorated with
3047 :func:`typing.overload` and then :func:`~hypothesis.strategies.composite`,
3048 although only in that order (:issue:`3970`).
3049
3050 .. _v6.100.3:
3051
3052 --------------------
3053 6.100.3 - 2024-05-04
3054 --------------------
3055
3056 This patch fixes a significant slowdown when using the :func:`~hypothesis.stateful.precondition` decorator in some cases, due to expensive repr formatting internally (:issue:`3963`).
3057
3058 .. _v6.100.2:
3059
3060 --------------------
3061 6.100.2 - 2024-04-28
3062 --------------------
3063
3064 Explicitly cast :obj:`numpy.finfo.smallest_normal <numpy.finfo>` to builtin `float` in
3065 preparation for the :pypi:`numpy==2.0 <numpy>` release (:issue:`3950`)
3066
3067 .. _v6.100.1:
3068
3069 --------------------
3070 6.100.1 - 2024-04-08
3071 --------------------
3072
3073 This patch improve a rare error message for flaky tests (:issue:`3940`).
3074
3075 .. _v6.100.0:
3076
3077 --------------------
3078 6.100.0 - 2024-03-31
3079 --------------------
3080
3081 The :func:`~hypothesis.extra.numpy.from_dtype` function no longer generates
3082 ``NaT`` ("not-a-time") values for the ``datetime64`` or ``timedelta64`` dtypes
3083 if passed ``allow_nan=False`` (:issue:`3943`).
3084
3085 .. _v6.99.13:
3086
3087 --------------------
3088 6.99.13 - 2024-03-24
3089 --------------------
3090
3091 This patch includes the :obj:`~hypothesis.settings.backend` setting in the
3092 ``how_generated`` field of our :ref:`observability output <observability>`.
3093
3094 .. _v6.99.12:
3095
3096 --------------------
3097 6.99.12 - 2024-03-23
3098 --------------------
3099
3100 If you were running Python 3.13 (currently in alpha) with :pypi:`pytest-xdist`
3101 and then attempted to pretty-print a ``lambda`` functions which was created
3102 using the :func:`eval` builtin, it would have raised an AssertionError.
3103 Now you'll get ``"lambda ...: <unknown>"``, as expected.
3104
3105 .. _v6.99.11:
3106
3107 --------------------
3108 6.99.11 - 2024-03-20
3109 --------------------
3110
3111 This release improves an internal invariant.
3112
3113 .. _v6.99.10:
3114
3115 --------------------
3116 6.99.10 - 2024-03-20
3117 --------------------
3118
3119 This patch fixes Hypothesis sometimes raising a ``Flaky`` error when generating collections of unique floats containing ``nan``. See :issue:`3926` for more details.
3120
3121 .. _v6.99.9:
3122
3123 -------------------
3124 6.99.9 - 2024-03-19
3125 -------------------
3126
3127 This patch continues our work on refactoring the shrinker (:issue:`3921`).
3128
3129 .. _v6.99.8:
3130
3131 -------------------
3132 6.99.8 - 2024-03-18
3133 -------------------
3134
3135 This patch continues our work on refactoring shrinker internals (:issue:`3921`).
3136
3137 .. _v6.99.7:
3138
3139 -------------------
3140 6.99.7 - 2024-03-18
3141 -------------------
3142
3143 This release resolves :py:exc:`PermissionError` that come from
3144 creating databases on inaccessible paths.
3145
3146 .. _v6.99.6:
3147
3148 -------------------
3149 6.99.6 - 2024-03-14
3150 -------------------
3151
3152 This patch starts work on refactoring our shrinker internals. There is no user-visible change.
3153
3154 .. _v6.99.5:
3155
3156 -------------------
3157 6.99.5 - 2024-03-12
3158 -------------------
3159
3160 This patch fixes a longstanding performance problem in stateful testing (:issue:`3618`),
3161 where state machines which generated a substantial amount of input for each step would
3162 hit the maximum amount of entropy and then fail with an ``Unsatisfiable`` error.
3163
3164 We now stop taking additional steps when we're approaching the entropy limit,
3165 which neatly resolves the problem without touching unaffected tests.
3166
3167 .. _v6.99.4:
3168
3169 -------------------
3170 6.99.4 - 2024-03-11
3171 -------------------
3172
3173 Fix regression caused by using :pep:`696` default in TypeVar with Python 3.13.0a3.
3174
3175 .. _v6.99.3:
3176
3177 -------------------
3178 6.99.3 - 2024-03-11
3179 -------------------
3180
3181 This patch further improves the type annotations in :mod:`hypothesis.extra.numpy`.
3182
3183 .. _v6.99.2:
3184
3185 -------------------
3186 6.99.2 - 2024-03-10
3187 -------------------
3188
3189 Simplify the type annotation of :func:`~hypothesis.extra.pandas.column` and
3190 :func:`~hypothesis.extra.pandas.columns` by using :pep:`696` to avoid overloading.
3191
3192 .. _v6.99.1:
3193
3194 -------------------
3195 6.99.1 - 2024-03-10
3196 -------------------
3197
3198 This patch implements type annotations for :func:`~hypothesis.extra.pandas.column`.
3199
3200 .. _v6.99.0:
3201
3202 -------------------
3203 6.99.0 - 2024-03-09
3204 -------------------
3205
3206 This release adds the **experimental and unstable** :obj:`~hypothesis.settings.backend`
3207 setting. See :ref:`alternative-backends` for details.
3208
3209 .. _v6.98.18:
3210
3211 --------------------
3212 6.98.18 - 2024-03-09
3213 --------------------
3214
3215 This patch fixes :issue:`3900`, a performance regression for
3216 :func:`~hypothesis.extra.numpy.arrays` due to the interaction of
3217 :ref:`v6.98.12` and :ref:`v6.97.1`.
3218
3219 .. _v6.98.17:
3220
3221 --------------------
3222 6.98.17 - 2024-03-04
3223 --------------------
3224
3225 This patch improves the type annotations in :mod:`hypothesis.extra.numpy`,
3226 which makes inferred types more precise for both :pypi:`mypy` and
3227 :pypi:`pyright`, and fixes some strict-mode errors on the latter.
3228
3229 Thanks to Jonathan Plasse for reporting and fixing this in :pull:`3889`!
3230
3231 .. _v6.98.16:
3232
3233 --------------------
3234 6.98.16 - 2024-03-04
3235 --------------------
3236
3237 This patch paves the way for future shrinker improvements. There is no user-visible change.
3238
3239 .. _v6.98.15:
3240
3241 --------------------
3242 6.98.15 - 2024-02-29
3243 --------------------
3244
3245 This release adds support for the Array API's `2023.12 release
3246 <https://data-apis.org/array-api/2023.12/>`_ via the ``api_version`` argument in
3247 :func:`~hypothesis.extra.array_api.make_strategies_namespace`. The API additions
3248 and modifications in the ``2023.12`` spec do not necessitate any changes in the
3249 Hypothesis strategies, hence there is no distinction between a ``2022.12`` and
3250 ``2023.12`` strategies namespace.
3251
3252 .. _v6.98.14:
3253
3254 --------------------
3255 6.98.14 - 2024-02-29
3256 --------------------
3257
3258 This patch adjusts the printing of bundle values to correspond
3259 with their names when using stateful testing.
3260
3261 .. _v6.98.13:
3262
3263 --------------------
3264 6.98.13 - 2024-02-27
3265 --------------------
3266
3267 This patch implements filter-rewriting for :func:`~hypothesis.strategies.text`
3268 and :func:`~hypothesis.strategies.binary` with the :meth:`~re.Pattern.search`,
3269 :meth:`~re.Pattern.match`, or :meth:`~re.Pattern.fullmatch` method of a
3270 :func:`re.compile`\ d regex.
3271
3272 .. _v6.98.12:
3273
3274 --------------------
3275 6.98.12 - 2024-02-25
3276 --------------------
3277
3278 This patch implements filter-rewriting for most length filters on some
3279 additional collection types (:issue:`3795`), and fixes several latent
3280 bugs where unsatisfiable or partially-infeasible rewrites could trigger
3281 internal errors.
3282
3283 .. _v6.98.11:
3284
3285 --------------------
3286 6.98.11 - 2024-02-24
3287 --------------------
3288
3289 This patch makes stateful testing somewhat less likely to get stuck
3290 when there are only a few possible rules.
3291
3292 .. _v6.98.10:
3293
3294 --------------------
3295 6.98.10 - 2024-02-22
3296 --------------------
3297
3298 This patch :pep:`adds a note <678>` to errors which occur while drawing from
3299 a strategy, to make it easier to tell why your test failed in such cases.
3300
3301 .. _v6.98.9:
3302
3303 -------------------
3304 6.98.9 - 2024-02-20
3305 -------------------
3306
3307 This patch ensures that :ref:`observability <observability>` outputs include
3308 an informative repr for :class:`~hypothesis.stateful.RuleBasedStateMachine`
3309 stateful tests, along with more detailed timing information.
3310
3311 .. _v6.98.8:
3312
3313 -------------------
3314 6.98.8 - 2024-02-18
3315 -------------------
3316
3317 This patch improves :ref:`the Ghostwriter <ghostwriter>` for binary operators.
3318
3319 .. _v6.98.7:
3320
3321 -------------------
3322 6.98.7 - 2024-02-18
3323 -------------------
3324
3325 This patch improves import-detection in :ref:`the Ghostwriter <ghostwriter>`
3326 (:issue:`3884`), particularly for :func:`~hypothesis.strategies.from_type`
3327 and strategies from ``hypothesis.extra.*``.
3328
3329 .. _v6.98.6:
3330
3331 -------------------
3332 6.98.6 - 2024-02-15
3333 -------------------
3334
3335 This patch clarifies the documentation on stateful testing (:issue:`3511`).
3336
3337 .. _v6.98.5:
3338
3339 -------------------
3340 6.98.5 - 2024-02-14
3341 -------------------
3342
3343 This patch improves argument-to-json conversion for :ref:`observability <observability>`
3344 output. Checking for a ``.to_json()`` method on the object *before* a few other
3345 options like dataclass support allows better user control of the process (:issue:`3880`).
3346
3347 .. _v6.98.4:
3348
3349 -------------------
3350 6.98.4 - 2024-02-12
3351 -------------------
3352
3353 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
3354 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
3355
3356 .. _v6.98.3:
3357
3358 -------------------
3359 6.98.3 - 2024-02-08
3360 -------------------
3361
3362 This patch fixes an error when generating :ref:`observability <observability>` reports involving large (``n > 1e308``) integers.
3363
3364 .. _v6.98.2:
3365
3366 -------------------
3367 6.98.2 - 2024-02-05
3368 -------------------
3369
3370 This patch refactors some internals. There is no user-visible change.
3371
3372 .. _v6.98.1:
3373
3374 -------------------
3375 6.98.1 - 2024-02-05
3376 -------------------
3377
3378 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.
3379
3380 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.
3381
3382 .. _v6.98.0:
3383
3384 -------------------
3385 6.98.0 - 2024-02-05
3386 -------------------
3387
3388 This release deprecates use of the global random number generator while drawing
3389 from a strategy, because this makes test cases less diverse and prevents us
3390 from reporting minimal counterexamples (:issue:`3810`).
3391
3392 If you see this new warning, you can get a quick fix by using
3393 :func:`~hypothesis.strategies.randoms`; or use more idiomatic strategies
3394 :func:`~hypothesis.strategies.sampled_from`, :func:`~hypothesis.strategies.floats`,
3395 :func:`~hypothesis.strategies.integers`, and so on.
3396
3397 Note that the same problem applies to e.g. ``numpy.random``, but
3398 for performance reasons we only check the stdlib :mod:`random` module -
3399 ignoring even other sources passed to :func:`~hypothesis.register_random`.
3400
3401 .. _v6.97.6:
3402
3403 -------------------
3404 6.97.6 - 2024-02-04
3405 -------------------
3406
3407 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
3408 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
3409
3410 .. _v6.97.5:
3411
3412 -------------------
3413 6.97.5 - 2024-02-03
3414 -------------------
3415
3416 This patch adds some :ref:`observability information <observability>`
3417 about how many times predicates in :func:`~hypothesis.assume` or
3418 :func:`~hypothesis.stateful.precondition` were satisfied, so that
3419 downstream tools can warn you if some were *never* satisfied by
3420 any test case.
3421
3422 .. _v6.97.4:
3423
3424 -------------------
3425 6.97.4 - 2024-01-31
3426 -------------------
3427
3428 This patch improves formatting and adds some cross-references to our docs.
3429
3430 .. _v6.97.3:
3431
3432 -------------------
3433 6.97.3 - 2024-01-30
3434 -------------------
3435
3436 Internal test refactoring.
3437
3438 .. _v6.97.2:
3439
3440 -------------------
3441 6.97.2 - 2024-01-30
3442 -------------------
3443
3444 This patch slightly changes how we replay examples from
3445 :ref:`the database <database>`: if the behavior of the saved example has
3446 changed, we now keep running the test case instead of aborting at the size
3447 of the saved example. While we know it's not the *same* example, we might
3448 as well continue running the test!
3449
3450 Because we now finish running a few more examples for affected tests, this
3451 might be a slight slowdown - but correspondingly more likely to find a bug.
3452
3453 We've also applied similar tricks to the |Phase.target| phase, where
3454 they are a pure performance improvement for affected tests.
3455
3456 .. _v6.97.1:
3457
3458 -------------------
3459 6.97.1 - 2024-01-27
3460 -------------------
3461
3462 Improves the performance of the :func:`~hypothesis.extra.numpy.arrays`
3463 strategy when generating unique values.
3464
3465 .. _v6.97.0:
3466
3467 -------------------
3468 6.97.0 - 2024-01-25
3469 -------------------
3470
3471 Changes the distribution of :func:`~hypothesis.strategies.sampled_from` when
3472 sampling from a :class:`~python:enum.Flag`. Previously, no-flags-set values would
3473 never be generated, and all-flags-set values would be unlikely for large enums.
3474 With this change, the distribution is more uniform in the number of flags set.
3475
3476 .. _v6.96.4:
3477
3478 -------------------
3479 6.96.4 - 2024-01-23
3480 -------------------
3481
3482 This patch slightly refactors some internals. There is no user-visible change.
3483
3484 .. _v6.96.3:
3485
3486 -------------------
3487 6.96.3 - 2024-01-22
3488 -------------------
3489
3490 This patch fixes a spurious warning about slow imports when ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY`` was set.
3491
3492 .. _v6.96.2:
3493
3494 -------------------
3495 6.96.2 - 2024-01-21
3496 -------------------
3497
3498 This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
3499
3500 .. _v6.96.1:
3501
3502 -------------------
3503 6.96.1 - 2024-01-18
3504 -------------------
3505
3506 Fix a spurious warning seen when running pytest's test
3507 suite, caused by never realizing we got out of
3508 initialization due to imbalanced hook calls.
3509
3510 .. _v6.96.0:
3511
3512 -------------------
3513 6.96.0 - 2024-01-17
3514 -------------------
3515
3516 Warns when constructing a `repr` that is overly long. This can
3517 happen by accident if stringifying arbitrary strategies, and
3518 is expensive in time and memory. The associated deferring of
3519 these long strings in :func:`~hypothesis.strategies.sampled_from`
3520 should also lead to improved performance.
3521
3522 .. _v6.95.0:
3523
3524 -------------------
3525 6.95.0 - 2024-01-17
3526 -------------------
3527
3528 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.
3529
3530 See also :issue:`3843`.
3531
3532 .. _v6.94.0:
3533
3534 -------------------
3535 6.94.0 - 2024-01-16
3536 -------------------
3537
3538 This release avoids creating a ``.hypothesis`` directory when using
3539 :func:`~hypothesis.strategies.register_type_strategy` (:issue:`3836`),
3540 and adds warnings for plugins which do so by other means or have
3541 other unintended side-effects.
3542
3543 .. _v6.93.2:
3544
3545 -------------------
3546 6.93.2 - 2024-01-15
3547 -------------------
3548
3549 This patch improves :ref:`observability <observability>` reports by moving
3550 timing information from ``metadata`` to a new ``timing`` key, and supporting
3551 conversion of additional argument types to json rather than string reprs
3552 via a ``.to_json()`` method (including e.g. Pandas dataframes).
3553
3554 Additionally, the :obj:`~hypothesis.HealthCheck.too_slow` health check will
3555 now report *which* strategies were slow, e.g. for strategies a, b, c, ...::
3556
3557 count | fraction | slowest draws (seconds)
3558 a | 3 | 65% | -- -- -- 0.357, 2.000
3559 b | 8 | 16% | 0.100, 0.100, 0.100, 0.111, 0.123
3560 c | 3 | 8% | -- -- 0.030, 0.050, 0.200
3561 (skipped 2 rows of fast draws)
3562
3563 .. _v6.93.1:
3564
3565 -------------------
3566 6.93.1 - 2024-01-15
3567 -------------------
3568
3569 This patch refactors some internals, continuing our work on supporting alternative backends
3570 (:issue:`3086`). There is no user-visible change.
3571
3572 .. _v6.93.0:
3573
3574 -------------------
3575 6.93.0 - 2024-01-13
3576 -------------------
3577
3578 The :func:`~hypothesis.extra.lark.from_lark` strategy now accepts an ``alphabet=``
3579 argument, which is passed through to :func:`~hypothesis.strategies.from_regex`,
3580 so that you can e.g. constrain the generated strings to a particular codec.
3581
3582 In support of this feature, :func:`~hypothesis.strategies.from_regex` will avoid
3583 generating optional parts which do not fit the alphabet. For example,
3584 ``from_regex(r"abc|def", alphabet="abcd")`` was previously an error, and will now
3585 generate only ``'abc'``. Cases where there are no valid strings remain an error.
3586
3587 .. _v6.92.9:
3588
3589 -------------------
3590 6.92.9 - 2024-01-12
3591 -------------------
3592
3593 This patch refactors some internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
3594
3595 .. _v6.92.8:
3596
3597 -------------------
3598 6.92.8 - 2024-01-11
3599 -------------------
3600
3601 This patch adds a :ref:`test statistics <statistics>` event when a generated example is rejected via :func:`assume <hypothesis.assume>`.
3602
3603 This may also help with distinguishing ``gave_up`` examples in :ref:`observability <observability>` (:issue:`3827`).
3604
3605 .. _v6.92.7:
3606
3607 -------------------
3608 6.92.7 - 2024-01-10
3609 -------------------
3610
3611 This introduces the rewriting of length filters on some collection strategies (:issue:`3791`).
3612
3613 Thanks to Reagan Lee for implementing this feature!
3614
3615 .. _v6.92.6:
3616
3617 -------------------
3618 6.92.6 - 2024-01-08
3619 -------------------
3620
3621 If a test uses :func:`~hypothesis.strategies.sampled_from` on a sequence of
3622 strategies, and raises a ``TypeError``, we now :pep:`add a note <678>` asking
3623 whether you meant to use :func:`~hypothesis.strategies.one_of`.
3624
3625 Thanks to Vince Reuter for suggesting and implementing this hint!
3626
3627 .. _v6.92.5:
3628
3629 -------------------
3630 6.92.5 - 2024-01-08
3631 -------------------
3632
3633 This patch registers explicit strategies for a handful of builtin types,
3634 motivated by improved introspection in PyPy 7.3.14 triggering existing
3635 internal warnings.
3636 Thanks to Carl Friedrich Bolz-Tereick for helping us work out what changed!
3637
3638 .. _v6.92.4:
3639
3640 -------------------
3641 6.92.4 - 2024-01-08
3642 -------------------
3643
3644 This patch fixes an error when writing :ref:`observability <observability>` reports without a pre-existing ``.hypothesis`` directory.
3645
3646 .. _v6.92.3:
3647
3648 -------------------
3649 6.92.3 - 2024-01-08
3650 -------------------
3651
3652 This patch adds a new environment variable ``HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY_NOCOVER``,
3653 which turns on :ref:`observability <observability>` data collection without collecting
3654 code coverage data, which may be faster on Python 3.11 and earlier.
3655
3656 Thanks to Harrison Goldstein for reporting and fixing :issue:`3821`.
3657
3658 .. _v6.92.2:
3659
3660 -------------------
3661 6.92.2 - 2023-12-27
3662 -------------------
3663
3664 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
3665 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
3666
3667 .. _v6.92.1:
3668
3669 -------------------
3670 6.92.1 - 2023-12-16
3671 -------------------
3672
3673 This patch fixes a bug introduced in :ref:`version 6.92.0 <v6.92.0>`,
3674 where using the :func:`~hypothesis.strategies.data` strategy would fail
3675 to draw a :func:`~python:dataclasses.dataclass` with a
3676 :class:`~python:collections.defaultdict` field. This was due to a bug
3677 in the standard library which `was fixed in 3.12
3678 <https://github.com/python/cpython/pull/32056>`__, so we've vendored the fix.
3679
3680 .. _v6.92.0:
3681
3682 -------------------
3683 6.92.0 - 2023-12-10
3684 -------------------
3685
3686 This release adds an experimental :wikipedia:`observability <Observability_(software)>`
3687 mode. :ref:`You can read the docs about it here <observability>`.
3688
3689 .. _v6.91.2:
3690
3691 -------------------
3692 6.91.2 - 2023-12-10
3693 -------------------
3694
3695 This patch refactors some more internals, continuing our work on supporting alternative backends (:issue:`3086`). There is no user-visible change.
3696
3697 .. _v6.91.1:
3698
3699 -------------------
3700 6.91.1 - 2023-12-08
3701 -------------------
3702
3703 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`.
3704
3705 This patch also adds support more generally for using :func:`~hypothesis.strategies.builds` with attrs' ``alias`` parameter, which was previously unsupported.
3706
3707 This patch increases the minimum required version of attrs to 22.2.0.
3708
3709 .. _v6.91.0:
3710
3711 -------------------
3712 6.91.0 - 2023-11-27
3713 -------------------
3714
3715 This release adds an optional ``payload`` argument to :func:`hypothesis.event`,
3716 so that you can clearly express the difference between the label and the value
3717 of an observation. :ref:`statistics` will still summarize it as a string, but
3718 future observability options can preserve the distinction.
3719
3720 .. _v6.90.1:
3721
3722 -------------------
3723 6.90.1 - 2023-11-27
3724 -------------------
3725
3726 This patch supports assigning ``settings = settings(...)`` as a class attribute
3727 on a subclass of a ``.TestCase`` attribute of a :class:`~hypothesis.stateful.RuleBasedStateMachine`.
3728 Previously, this did nothing at all.
3729
3730 .. code-block:: python
3731
3732 # works as of this release
3733 class TestMyStatefulMachine(MyStatefulMachine.TestCase):
3734 settings = settings(max_examples=10000)
3735
3736 # the old way still works, but it's more verbose.
3737 MyStateMachine.TestCase.settings = settings(max_examples=10000)
3738
3739 class TestMyStatefulMachine(MyStatefulMachine.TestCase):
3740 pass
3741
3742 Thanks to Joey Tran for reporting these settings-related edge cases in stateful testing.
3743
3744 .. _v6.90.0:
3745
3746 -------------------
3747 6.90.0 - 2023-11-20
3748 -------------------
3749
3750 This release makes it an error to assign ``settings = settings(...)``
3751 as a class attribute on a :class:`~hypothesis.stateful.RuleBasedStateMachine`.
3752 This has never had any effect, and it should be used as a decorator instead:
3753
3754 .. code-block:: python
3755
3756 class BadMachine(RuleBasedStateMachine):
3757 """This doesn't do anything, and is now an error!"""
3758
3759 settings = settings(derandomize=True)
3760
3761 @settings(derandomize=True)
3762 class GoodMachine(RuleBasedStateMachine):
3763 """This is the right way to do it :-)"""
3764
3765 .. _v6.89.1:
3766
3767 -------------------
3768 6.89.1 - 2023-11-19
3769 -------------------
3770
3771 This patch refactors some internals. There is no user-visible change,
3772 but we hope to improve performance and unlock support for alternative
3773 backends such as :pypi:`symbolic execution with crosshair <crosshair-tool>`
3774 in future (:issue:`3086`).
3775
3776 Thanks to Liam DeVoe for this fantastic contribution!
3777
3778 .. _v6.89.0:
3779
3780 -------------------
3781 6.89.0 - 2023-11-16
3782 -------------------
3783
3784 This release teaches :func:`~hypothesis.strategies.from_type` to handle constraints
3785 implied by the :pypi:`annotated-types` package - as used by e.g. :pypi:`pydantic`.
3786 This is usually efficient, but falls back to filtering in a few remaining cases.
3787
3788 Thanks to Viicos for :pull:`3780`!
3789
3790 .. _v6.88.4:
3791
3792 -------------------
3793 6.88.4 - 2023-11-13
3794 -------------------
3795
3796 This patch adds a warning when :func:`@st.composite <hypothesis.strategies.composite>`
3797 wraps a function annotated as returning a :class:`~hypothesis.strategies.SearchStrategy`,
3798 since this is usually an error (:issue:`3786`). The function should return a value,
3799 and the decorator will convert it to a function which returns a strategy.
3800
3801 .. _v6.88.3:
3802
3803 -------------------
3804 6.88.3 - 2023-11-05
3805 -------------------
3806
3807 This patch refactors ``from_type(typing.Tuple)``, allowing
3808 :func:`~hypothesis.strategies.register_type_strategy` to take effect
3809 for tuples instead of being silently ignored (:issue:`3750`).
3810
3811 Thanks to Nick Collins for reporting and extensive work on this issue.
3812
3813 .. _v6.88.2:
3814
3815 -------------------
3816 6.88.2 - 2023-11-05
3817 -------------------
3818
3819 This patch improves the speed of the explain phase on python 3.12+, by using the new
3820 :mod:`sys.monitoring` module to collect coverage, instead of :obj:`sys.settrace`.
3821
3822 Thanks to Liam DeVoe for :pull:`3776`!
3823
3824 .. _v6.88.1:
3825
3826 -------------------
3827 6.88.1 - 2023-10-16
3828 -------------------
3829
3830 This patch improves :func:`~hypothesis.strategies.register_type_strategy` when used with ``tuple`` subclasses,
3831 by preventing them from being interpreted as generic and provided to strategies like ``st.from_type(Sequence[int])``
3832 (:issue:`3767`).
3833
3834 .. _v6.88.0:
3835
3836 -------------------
3837 6.88.0 - 2023-10-15
3838 -------------------
3839
3840 This release allows strategy-generating functions registered with
3841 :func:`~hypothesis.strategies.register_type_strategy` to conditionally not
3842 return a strategy, by returning :data:`NotImplemented` (:issue:`3767`).
3843
3844 .. _v6.87.4:
3845
3846 -------------------
3847 6.87.4 - 2023-10-12
3848 -------------------
3849
3850 When :func:`~hypothesis.strategies.randoms` was called with ``use_true_randoms=False``,
3851 calling ``r.sample([], 0)`` would result in an error,
3852 when it should have returned an empty sequence to agree with the normal behaviour of
3853 :func:`random.sample`. This fixes that discrepancy (:issue:`3765`).
3854
3855 .. _v6.87.3:
3856
3857 -------------------
3858 6.87.3 - 2023-10-06
3859 -------------------
3860
3861 This patch ensures that the :ref:`hypothesis codemod <codemods>` CLI
3862 will print a warning instead of stopping with an internal error if
3863 one of your files contains invalid syntax (:issue:`3759`).
3864
3865 .. _v6.87.2:
3866
3867 -------------------
3868 6.87.2 - 2023-10-06
3869 -------------------
3870
3871 This patch makes some small changes to our NumPy integration to ensure forward
3872 compatibility. Thanks to Mateusz Sokół for :pull:`3761`.
3873
3874 .. _v6.87.1:
3875
3876 -------------------
3877 6.87.1 - 2023-10-01
3878 -------------------
3879
3880 Fixes :issue:`3755`, where an internal condition turns out
3881 to be reachable after all.
3882
3883 .. _v6.87.0:
3884
3885 -------------------
3886 6.87.0 - 2023-09-25
3887 -------------------
3888
3889 This release deprecates use of :func:`~hypothesis.assume` and ``reject()``
3890 outside of property-based tests, because these functions work by raising a
3891 special exception (:issue:`3743`). It also fixes some type annotations
3892 (:issue:`3753`).
3893
3894 .. _v6.86.2:
3895
3896 -------------------
3897 6.86.2 - 2023-09-18
3898 -------------------
3899
3900 Hotfix for :issue:`3747`, a bug in explain mode which is so rare that
3901 we missed it in six months of dogfooding. Thanks to :pypi:`mygrad`
3902 for discovering and promptly reporting this!
3903
3904 .. _v6.86.1:
3905
3906 -------------------
3907 6.86.1 - 2023-09-17
3908 -------------------
3909
3910 This patch improves the documentation of :obj:`@example(...).xfail() <hypothesis.example.xfail>`
3911 by adding a note about :pep:`614`, similar to :obj:`@example(...).via() <hypothesis.example.via>`,
3912 and adds a warning when a strategy generates a test case which seems identical to
3913 one provided by an xfailed example.
3914
3915 .. _v6.86.0:
3916
3917 -------------------
3918 6.86.0 - 2023-09-17
3919 -------------------
3920
3921 This release enables the |Phase.explain| phase
3922 by default. We hope it helps you to understand *why* your failing tests have
3923 failed!
3924
3925 .. _v6.85.1:
3926
3927 -------------------
3928 6.85.1 - 2023-09-16
3929 -------------------
3930
3931 This patch switches some of our type annotations to use :obj:`typing.Literal`
3932 when only a few specific values are allowed, such as UUID or IP address versions.
3933
3934 .. _v6.85.0:
3935
3936 -------------------
3937 6.85.0 - 2023-09-16
3938 -------------------
3939
3940 This release deprecates the old whitelist/blacklist arguments
3941 to :func:`~hypothesis.strategies.characters`, in favor of
3942 include/exclude arguments which more clearly describe their
3943 effects on the set of characters which can be generated.
3944
3945 You can :ref:`use Hypothesis' codemods <codemods>` to automatically
3946 upgrade to the new argument names. In a future version, the old
3947 names will start to raise a ``DeprecationWarning``.
3948
3949 .. _v6.84.3:
3950
3951 -------------------
3952 6.84.3 - 2023-09-10
3953 -------------------
3954
3955 This patch automatically disables the :obj:`~hypothesis.HealthCheck.differing_executors`
3956 health check for methods which are also pytest parametrized tests, because
3957 those were mostly false alarms (:issue:`3733`).
3958
3959 .. _v6.84.2:
3960
3961 -------------------
3962 6.84.2 - 2023-09-06
3963 -------------------
3964
3965 Building on recent releases, :func:`~hypothesis.strategies.characters`
3966 now accepts _any_ ``codec=``, not just ``"utf-8"`` and ``"ascii"``.
3967
3968 This includes standard codecs from the :mod:`codecs` module and their
3969 aliases, platform specific and user-registered codecs if they are
3970 available, and `python-specific text encodings
3971 <https://docs.python.org/3/library/codecs.html#python-specific-encodings>`__
3972 (but not text transforms or binary transforms).
3973
3974 .. _v6.84.1:
3975
3976 -------------------
3977 6.84.1 - 2023-09-05
3978 -------------------
3979
3980 This patch by Reagan Lee makes ``st.text(...).filter(str.isidentifier)``
3981 return an efficient custom strategy (:issue:`3480`).
3982
3983 .. _v6.84.0:
3984
3985 -------------------
3986 6.84.0 - 2023-09-04
3987 -------------------
3988
3989 The :func:`~hypothesis.strategies.from_regex` strategy now takes an optional
3990 ``alphabet=characters(codec="utf-8")`` argument for unicode strings, like
3991 :func:`~hypothesis.strategies.text`.
3992
3993 This offers more and more-consistent control over the generated strings,
3994 removing previously-hard-coded limitations. With ``fullmatch=False`` and
3995 ``alphabet=characters()``, surrogate characters are now possible in leading
3996 and trailing text as well as the body of the match. Negated character classes
3997 such as ``[^A-Z]`` or ``\S`` had a hard-coded exclusion of control characters
3998 and surrogate characters; now they permit anything in ``alphabet=`` consistent
3999 with the class, and control characters are permitted by default.
4000
4001 .. _v6.83.2:
4002
4003 -------------------
4004 6.83.2 - 2023-09-04
4005 -------------------
4006
4007 Add a health check that detects if the same test is executed
4008 several times by :ref:`different executors<custom-function-execution>`.
4009 This can lead to difficult-to-debug problems such as :issue:`3446`.
4010
4011 .. _v6.83.1:
4012
4013 -------------------
4014 6.83.1 - 2023-09-03
4015 -------------------
4016
4017 Pretty-printing of failing examples can now use functions registered with
4018 :func:`IPython.lib.pretty.for_type` or :func:`~IPython.lib.pretty.for_type_by_name`,
4019 as well as restoring compatibility with ``_repr_pretty_`` callback methods
4020 which were accidentally broken in :ref:`version 6.61.2 <v6.61.2>` (:issue:`3721`).
4021
4022 .. _v6.83.0:
4023
4024 -------------------
4025 6.83.0 - 2023-09-01
4026 -------------------
4027
4028 Adds a new ``codec=`` option in :func:`~hypothesis.strategies.characters`, making it
4029 convenient to produce only characters which can be encoded as ``ascii`` or ``utf-8``
4030 bytestrings.
4031
4032 Support for other codecs will be added in a future release.
4033
4034 .. _v6.82.7:
4035
4036 -------------------
4037 6.82.7 - 2023-08-28
4038 -------------------
4039
4040 This patch updates our autoformatting tools, improving our code style without any API changes.
4041
4042 .. _v6.82.6:
4043
4044 -------------------
4045 6.82.6 - 2023-08-20
4046 -------------------
4047
4048 This patch enables and fixes many more of :pypi:`ruff`\ 's lint rules.
4049
4050 .. _v6.82.5:
4051
4052 -------------------
4053 6.82.5 - 2023-08-18
4054 -------------------
4055
4056 Fixes the error message for missing ``[cli]`` extra.
4057
4058 .. _v6.82.4:
4059
4060 -------------------
4061 6.82.4 - 2023-08-12
4062 -------------------
4063
4064 This patch ensures that we always close the download connection in
4065 :class:`~hypothesis.database.GitHubArtifactDatabase`.
4066
4067 .. _v6.82.3:
4068
4069 -------------------
4070 6.82.3 - 2023-08-08
4071 -------------------
4072
4073 We can now pretty-print combinations of *zero* :class:`enum.Flag`
4074 values, like ``SomeFlag(0)``, which has never worked before.
4075
4076 .. _v6.82.2:
4077
4078 -------------------
4079 6.82.2 - 2023-08-06
4080 -------------------
4081
4082 This patch fixes pretty-printing of combinations of :class:`enum.Flag`
4083 values, which was previously an error (:issue:`3709`).
4084
4085 .. _v6.82.1:
4086
4087 -------------------
4088 6.82.1 - 2023-08-05
4089 -------------------
4090
4091 Improve shrinking of floats in narrow regions that don't cross an integer
4092 boundary. Closes :issue:`3357`.
4093
4094 .. _v6.82.0:
4095
4096 -------------------
4097 6.82.0 - 2023-07-20
4098 -------------------
4099
4100 :func:`~hypothesis.strategies.from_regex` now supports the atomic grouping
4101 (``(?>...)``) and possessive quantifier (``*+``, ``++``, ``?+``, ``{m,n}+``)
4102 syntax `added in Python 3.11 <https://docs.python.org/3/whatsnew/3.11.html#re>`__.
4103
4104 Thanks to Cheuk Ting Ho for implementing this!
4105
4106 .. _v6.81.2:
4107
4108 -------------------
4109 6.81.2 - 2023-07-15
4110 -------------------
4111
4112 If the :envvar:`HYPOTHESIS_NO_PLUGINS` environment variable is set, we'll avoid
4113 :ref:`loading plugins <entry-points>` such as `the old Pydantic integration
4114 <https://docs.pydantic.dev/latest/integrations/hypothesis/>`__ or
4115 `HypoFuzz' CLI options <https://hypofuzz.com/docs/quickstart.html#running-hypothesis-fuzz>`__.
4116
4117 This is probably only useful for our own self-tests, but documented in case it might
4118 help narrow down any particularly weird bugs in complex environments.
4119
4120 .. _v6.81.1:
4121
4122 -------------------
4123 6.81.1 - 2023-07-11
4124 -------------------
4125
4126 Fixes some lingering issues with inference of recursive types
4127 in :func:`~hypothesis.strategies.from_type`. Closes :issue:`3525`.
4128
4129 .. _v6.81.0:
4130
4131 -------------------
4132 6.81.0 - 2023-07-10
4133 -------------------
4134
4135 This release further improves our ``.patch``-file support from
4136 :ref:`version 6.75 <v6.75.0>`, skipping duplicates, tests which use
4137 :func:`~hypothesis.strategies.data` (and don't support
4138 :obj:`@example() <hypothesis.example>`\ ), and various broken edge-cases.
4139
4140 Because :pypi:`libCST <libcst>` has released version 1.0 which uses the native parser
4141 by default, we no longer set the ``LIBCST_PARSER_TYPE=native`` environment
4142 variable. If you are using an older version, you may need to upgrade or
4143 set this envvar for yourself.
4144
4145 .. _v6.80.1:
4146
4147 -------------------
4148 6.80.1 - 2023-07-06
4149 -------------------
4150
4151 This patch updates some internal code for selftests.
4152 There is no user-visible change.
4153
4154 .. _v6.80.0:
4155
4156 -------------------
4157 6.80.0 - 2023-06-27
4158 -------------------
4159
4160 This release drops support for Python 3.7, `which reached end of life on
4161 2023-06-27 <https://devguide.python.org/versions/>`__.
4162
4163 .. _v6.79.4:
4164
4165 -------------------
4166 6.79.4 - 2023-06-27
4167 -------------------
4168
4169 Fixes occasional recursion-limit-exceeded errors when validating
4170 deeply nested strategies. Closes: :issue:`3671`
4171
4172 .. _v6.79.3:
4173
4174 -------------------
4175 6.79.3 - 2023-06-26
4176 -------------------
4177
4178 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
4179 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
4180
4181 .. _v6.79.2:
4182
4183 -------------------
4184 6.79.2 - 2023-06-22
4185 -------------------
4186
4187 Improve the type rendered in :func:`~hypothesis.strategies.from_type`,
4188 which improves the coverage of Ghostwriter.
4189
4190 .. _v6.79.1:
4191
4192 -------------------
4193 6.79.1 - 2023-06-19
4194 -------------------
4195
4196 We now test against Python 3.12 beta in CI, and this patch
4197 fixes some new deprecations.
4198
4199 .. _v6.79.0:
4200
4201 -------------------
4202 6.79.0 - 2023-06-17
4203 -------------------
4204
4205 This release changes :func:`~hypothesis.strategies.register_type_strategy`
4206 for compatibility with :pep:`585`: we now store only a single strategy or
4207 resolver function which is used for both the builtin and the ``typing``
4208 module version of each type (:issue:`3635`).
4209
4210 If you previously relied on registering separate strategies for e.g.
4211 ``list`` vs ``typing.List``, you may need to use explicit strategies
4212 rather than inferring them from types.
4213
4214 .. _v6.78.3:
4215
4216 -------------------
4217 6.78.3 - 2023-06-15
4218 -------------------
4219
4220 This release ensures that Ghostwriter does not use the deprecated aliases
4221 for the ``collections.abc`` classes in ``collections``.
4222
4223 .. _v6.78.2:
4224
4225 -------------------
4226 6.78.2 - 2023-06-13
4227 -------------------
4228
4229 This patch improves Ghostwriter's use of qualified names for re-exported
4230 functions and classes, and avoids importing useless :obj:`~typing.TypeVar`\ s.
4231
4232 .. _v6.78.1:
4233
4234 -------------------
4235 6.78.1 - 2023-06-12
4236 -------------------
4237
4238 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
4239 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
4240
4241 .. _v6.78.0:
4242
4243 -------------------
4244 6.78.0 - 2023-06-11
4245 -------------------
4246
4247 New input validation for :func:`~hypothesis.strategies.recursive`
4248 will raise an error rather than hanging indefinitely if passed
4249 invalid ``max_leaves=`` arguments.
4250
4251 .. _v6.77.0:
4252
4253 -------------------
4254 6.77.0 - 2023-06-09
4255 -------------------
4256
4257 :func:`~hypothesis.strategies.from_type` now handles numpy array types:
4258 :obj:`np.typing.ArrayLike <numpy.typing.ArrayLike>`,
4259 :obj:`np.typing.NDArray <numpy.typing.NDArray>`, and parameterized
4260 versions including :class:`np.ndarray[shape, elem_type] <numpy.ndarray>`.
4261
4262 .. _v6.76.0:
4263
4264 -------------------
4265 6.76.0 - 2023-06-04
4266 -------------------
4267
4268 Warn in :func:`~hypothesis.strategies.from_type` if the inferred strategy
4269 has no variation (always returning default instances). Also handles numpy
4270 data types by calling :func:`~hypothesis.extra.numpy.from_dtype` on the
4271 corresponding dtype, thus ensuring proper variation for these types.
4272
4273 .. _v6.75.9:
4274
4275 -------------------
4276 6.75.9 - 2023-05-31
4277 -------------------
4278
4279 :func:`~hypothesis.strategies.from_type` now works in cases where we use
4280 :func:`~hypothesis.strategies.builds` to create an instance and the constructor
4281 has an argument which would lead to recursion. Previously, this would raise
4282 an error if the argument had a default value.
4283
4284 Thanks to Joachim B Haga for reporting and fixing this problem.
4285
4286 .. _v6.75.8:
4287
4288 -------------------
4289 6.75.8 - 2023-05-31
4290 -------------------
4291
4292 In preparation for supporting JAX in :ref:`hypothesis.extra.array_api <array-api>`,
4293 this release supports immutable arrays being generated via :func:`xps.arrays`.
4294 In particular, we internally removed an instance of in-place array modification,
4295 which isn't possible for an immutable array.
4296
4297 .. _v6.75.7:
4298
4299 -------------------
4300 6.75.7 - 2023-05-30
4301 -------------------
4302
4303 This release fixes some ``.patch``-file bugs from :ref:`version 6.75 <v6.75.0>`,
4304 and adds automatic support for writing ``@hypothesis.example()`` or ``@example()``
4305 depending on the current style in your test file - defaulting to the latter.
4306
4307 Note that this feature requires :pypi:`libcst` to be installed, and :pypi:`black`
4308 is strongly recommended. You can ensure you have the dependencies with
4309 ``pip install "hypothesis[cli,codemods]"``.
4310
4311 .. _v6.75.6:
4312
4313 -------------------
4314 6.75.6 - 2023-05-27
4315 -------------------
4316
4317 This patch continues the work started in :pull:`3651` by adding
4318 :pypi:`ruff` linter rules for :pypi:`pyflakes`, :pypi:`flake8-comprehensions`,
4319 and :pypi:`flake8-implicit-str-concat`.
4320
4321 .. _v6.75.5:
4322
4323 -------------------
4324 6.75.5 - 2023-05-26
4325 -------------------
4326
4327 This patch updates our linter stack to use :pypi:`ruff`, and fixes some
4328 previously-ignored lints. Thanks to Christian Clauss for his careful
4329 review and :pull:`3651`!
4330
4331 .. _v6.75.4:
4332
4333 -------------------
4334 6.75.4 - 2023-05-26
4335 -------------------
4336
4337 Hypothesis will now record an event for more cases where data is marked
4338 invalid, including for exceeding the internal depth limit.
4339
4340 .. _v6.75.3:
4341
4342 -------------------
4343 6.75.3 - 2023-05-14
4344 -------------------
4345
4346 This patch fixes :func:`~hypothesis.strategies.complex_numbers` accidentally
4347 invalidating itself when passed magnitude arguments for 32 and 64-bit widths,
4348 i.e. 16- and 32-bit floats, due to not internally down-casting numbers (:issue:`3573`).
4349
4350 .. _v6.75.2:
4351
4352 -------------------
4353 6.75.2 - 2023-05-04
4354 -------------------
4355
4356 Improved the documentation regarding how to use :class:`~hypothesis.database.GitHubArtifactDatabase`
4357 and fixed a bug that occurred in repositories with no existing artifacts.
4358
4359 Thanks to Agustín Covarrubias for this contribution.
4360
4361 .. _v6.75.1:
4362
4363 -------------------
4364 6.75.1 - 2023-04-30
4365 -------------------
4366
4367 ``hypothesis.errors`` will now raise :py:exc:`AttributeError` when attempting
4368 to access an undefined attribute, rather than returning :py:obj:`None`.
4369
4370 .. _v6.75.0:
4371
4372 -------------------
4373 6.75.0 - 2023-04-30
4374 -------------------
4375
4376 Sick of adding :obj:`@example() <hypothesis.example>`\ s by hand?
4377 Our Pytest plugin now writes ``.patch`` files to insert them for you, making
4378 `this workflow <https://blog.nelhage.com/post/property-testing-like-afl/>`__
4379 easier than ever before.
4380
4381 Note that you'll need :pypi:`LibCST <libcst>` (via :ref:`codemods`), and that
4382 :obj:`@example().via() <hypothesis.example.via>` requires :pep:`614`
4383 (Python 3.9 or later).
4384
4385 .. _v6.74.1:
4386
4387 -------------------
4388 6.74.1 - 2023-04-28
4389 -------------------
4390
4391 This patch provides better error messages for datetime- and timedelta-related
4392 invalid dtypes in our Pandas extra (:issue:`3518`).
4393 Thanks to Nick Muoh at the PyCon Sprints!
4394
4395 .. _v6.74.0:
4396
4397 -------------------
4398 6.74.0 - 2023-04-26
4399 -------------------
4400
4401 This release adds support for `nullable pandas dtypes <https://pandas.pydata.org/docs/user_guide/integer_na.html>`__
4402 in :func:`~hypothesis.extra.pandas` (:issue:`3604`).
4403 Thanks to Cheuk Ting Ho for implementing this at the PyCon sprints!
4404
4405 .. _v6.73.1:
4406
4407 -------------------
4408 6.73.1 - 2023-04-27
4409 -------------------
4410
4411 This patch updates our minimum Numpy version to 1.16, and restores compatibility
4412 with versions before 1.20, which were broken by a mistake in Hypothesis 6.72.4
4413 (:issue:`3625`).
4414
4415 .. _v6.73.0:
4416
4417 -------------------
4418 6.73.0 - 2023-04-25
4419 -------------------
4420
4421 This release upgrades the |Phase.explain| phase (:issue:`3411`).
4422
4423 * Following the first failure, Hypothesis will (usually, depending on the enabled |Phase|) track which
4424 lines of code were executed by passing and failing examples, and report where they
4425 diverged - with some heuristics to drop unhelpful reports. This is an existing
4426 feature, now upgraded and newly enabled by default.
4427
4428 * After shrinking to a minimal failing example, Hypothesis will try to find parts of
4429 the example -- e.g. separate args to :func:`@given() <hypothesis.given>` -- which
4430 can vary freely without changing the result of that minimal failing example.
4431 If the automated experiments run without finding a passing variation, we leave a
4432 comment in the final report:
4433
4434 .. code-block:: python
4435
4436 test_x_divided_by_y(
4437 x=0, # or any other generated value
4438 y=0,
4439 )
4440
4441 Just remember that the *lack* of an explanation sometimes just means that Hypothesis
4442 couldn't efficiently find one, not that no explanation (or simpler failing example)
4443 exists.
4444
4445 .. _v6.72.4:
4446
4447 -------------------
4448 6.72.4 - 2023-04-25
4449 -------------------
4450
4451 This patch fixes type annotations for the :func:`~hypothesis.extra.numpy.arrays`
4452 strategy. Thanks to Francesc Elies for :pull:`3602`.
4453
4454 .. _v6.72.3:
4455
4456 -------------------
4457 6.72.3 - 2023-04-25
4458 -------------------
4459
4460 This patch fixes a bug with :func:`~hypothesis.strategies.from_type()` with ``dict[tuple[int, int], str]``
4461 (:issue:`3527`). Thanks to Nick Muoh at the PyCon Sprints!
4462
4463 .. _v6.72.2:
4464
4465 -------------------
4466 6.72.2 - 2023-04-24
4467 -------------------
4468
4469 This patch refactors our internals to facilitate an upcoming feature.
4470
4471 .. _v6.72.1:
4472
4473 -------------------
4474 6.72.1 - 2023-04-19
4475 -------------------
4476
4477 This patch fixes some documentation and prepares for future features.
4478
4479 .. _v6.72.0:
4480
4481 -------------------
4482 6.72.0 - 2023-04-16
4483 -------------------
4484
4485 This release deprecates ``Healthcheck.all()``, and :ref:`adds a codemod <codemods>`
4486 to automatically replace it with ``list(Healthcheck)`` (:issue:`3596`).
4487
4488 .. _v6.71.0:
4489
4490 -------------------
4491 6.71.0 - 2023-04-07
4492 -------------------
4493
4494 This release adds :class:`~hypothesis.database.GitHubArtifactDatabase`, a new database
4495 backend that allows developers to access the examples found by a Github Actions CI job.
4496 This is particularly useful for workflows that involve continuous fuzzing,
4497 like `HypoFuzz <https://hypofuzz.com/>`__.
4498
4499 Thanks to Agustín Covarrubias for this feature!
4500
4501 .. _v6.70.2:
4502
4503 -------------------
4504 6.70.2 - 2023-04-03
4505 -------------------
4506
4507 This patch clarifies the reporting of time spent generating data. A
4508 simple arithmetic mean of the percentage of time spent can be
4509 misleading; reporting the actual time spent avoids misunderstandings.
4510
4511 Thanks to Andrea Reina for reporting and fixing :issue:`3598`!
4512
4513 .. _v6.70.1:
4514
4515 -------------------
4516 6.70.1 - 2023-03-27
4517 -------------------
4518
4519 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
4520 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
4521
4522 .. _v6.70.0:
4523
4524 -------------------
4525 6.70.0 - 2023-03-16
4526 -------------------
4527
4528 This release adds an optional ``domains=`` parameter to the
4529 :func:`~hypothesis.strategies.emails` strategy, and excludes
4530 the special-use :wikipedia:`.arpa` domain from the default
4531 strategy (:issue:`3567`).
4532
4533 Thanks to Jens Tröger for reporting and fixing this bug!
4534
4535 .. _v6.69.0:
4536
4537 -------------------
4538 6.69.0 - 2023-03-15
4539 -------------------
4540
4541 This release turns ``HealthCheck.return_value`` and ``HealthCheck.not_a_test_method``
4542 into unconditional errors. Passing them to ``suppress_health_check=`` is therefore a deprecated no-op.
4543 (:issue:`3568`). Thanks to Reagan Lee for the patch!
4544
4545 Separately, GraalPy can now run and pass most of the hypothesis test suite (:issue:`3587`).
4546
4547 .. _v6.68.3:
4548
4549 -------------------
4550 6.68.3 - 2023-03-15
4551 -------------------
4552
4553 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
4554 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
4555
4556 .. _v6.68.2:
4557
4558 -------------------
4559 6.68.2 - 2023-02-17
4560 -------------------
4561
4562 This patch fixes missing imports of the :mod:`re` module, when :ref:`ghostwriting <ghostwriter>`
4563 tests which include compiled patterns or regex flags.
4564 Thanks to Jens Heinrich for reporting and promptly fixing this bug!
4565
4566 .. _v6.68.1:
4567
4568 -------------------
4569 6.68.1 - 2023-02-12
4570 -------------------
4571
4572 This patch adds some private hooks for use in research on
4573 `Schemathesis <https://github.com/schemathesis/schemathesis>`__
4574 (`see our preprint here <https://arxiv.org/abs/2112.10328>`__).
4575
4576 .. _v6.68.0:
4577
4578 -------------------
4579 6.68.0 - 2023-02-09
4580 -------------------
4581
4582 This release adds support for the Array API's `2022.12 release
4583 <https://data-apis.org/array-api/2022.12/>`_ via the ``api_version`` argument in
4584 :func:`~hypothesis.extra.array_api.make_strategies_namespace`. Concretely this
4585 involves complex support in its existing strategies, plus an introduced
4586 :func:`xps.complex_dtypes` strategy.
4587
4588 Additionally this release now treats :ref:`hypothesis.extra.array_api
4589 <array-api>` as stable, meaning breaking changes should only happen with major
4590 releases of Hypothesis.
4591
4592 .. _v6.67.1:
4593
4594 -------------------
4595 6.67.1 - 2023-02-05
4596 -------------------
4597
4598 This patch updates our autoformatting tools, improving our code style without any API changes.
4599
4600 .. _v6.67.0:
4601
4602 -------------------
4603 6.67.0 - 2023-02-05
4604 -------------------
4605
4606 This release allows for more precise generation of complex numbers using
4607 :func:`~hypothesis.extra.numpy.from_dtype`, by supporting the ``width``,
4608 ``min_magnitude``, and ``min_magnitude`` arguments (:issue:`3468`).
4609
4610 Thanks to Felix Divo for this feature!
4611
4612 .. _v6.66.2:
4613
4614 -------------------
4615 6.66.2 - 2023-02-04
4616 -------------------
4617
4618 This patch fixes a rare ``RecursionError`` when pretty-printing a multi-line
4619 object without type-specific printer, which was passed to a function which
4620 returned the same object by ``.map()`` or :func:`~hypothesis.strategies.builds`
4621 and thus recursed due to the new pretty reprs in Hypothesis :ref:`v6.65.0`
4622 (:issue:`3560`). Apologies to all those affected.
4623
4624 .. _v6.66.1:
4625
4626 -------------------
4627 6.66.1 - 2023-02-03
4628 -------------------
4629
4630 This makes :func:`~hypothesis.extra.numpy.from_dtype` pass through the parameter
4631 ``allow_subnormal`` for complex dtypes.
4632
4633 .. _v6.66.0:
4634
4635 -------------------
4636 6.66.0 - 2023-02-02
4637 -------------------
4638
4639 This release adds a ``width`` parameter to :func:`~hypothesis.strategies.complex_numbers`,
4640 analogously to :func:`~hypothesis.strategies.floats`.
4641
4642 Thanks to Felix Divo for the new feature!
4643
4644 .. _v6.65.2:
4645
4646 -------------------
4647 6.65.2 - 2023-01-27
4648 -------------------
4649
4650 This patch fixes invalid annotations detected for the tests generated by
4651 :ref:`Ghostwriter <ghostwriter>`. It will now correctly generate ``Optional``
4652 types with just one type argument and handle union expressions inside of type
4653 arguments correctly. Additionally, it now supports code with the
4654 ``from __future__ import annotations`` marker for Python 3.10 and newer.
4655
4656 .. _v6.65.1:
4657
4658 -------------------
4659 6.65.1 - 2023-01-26
4660 -------------------
4661
4662 This release improves the pretty-printing of enums in falsifying examples,
4663 so that they print as their full identifier rather than their repr.
4664
4665 .. _v6.65.0:
4666
4667 -------------------
4668 6.65.0 - 2023-01-24
4669 -------------------
4670
4671 Hypothesis now reports some failing inputs by showing the call which constructed
4672 an object, rather than the repr of the object. This can be helpful when the default
4673 repr does not include all relevant details, and will unlock further improvements
4674 in a future version.
4675
4676 For now, we capture calls made via :func:`~hypothesis.strategies.builds`, and via
4677 |.map|.
4678
4679 .. _v6.64.0:
4680
4681 -------------------
4682 6.64.0 - 2023-01-23
4683 -------------------
4684
4685 The :ref:`Ghostwriter <ghostwriter>` will now include type annotations on tests
4686 for type-annotated code. If you want to force this to happen (or not happen),
4687 pass a boolean to the new ``annotate=`` argument to the Python functions, or
4688 the ``--[no-]annotate`` CLI flag.
4689
4690 Thanks to Nicolas Ganz for this new feature!
4691
4692 .. _v6.63.0:
4693
4694 -------------------
4695 6.63.0 - 2023-01-20
4696 -------------------
4697
4698 :func:`~hypothesis.extra.pandas.range_indexes` now accepts a ``name=`` argument,
4699 to generate named :class:`pandas.RangeIndex` objects.
4700
4701 Thanks to Sam Watts for this new feature!
4702
4703 .. _v6.62.1:
4704
4705 -------------------
4706 6.62.1 - 2023-01-14
4707 -------------------
4708
4709 This patch tweaks :func:`xps.arrays` internals to improve PyTorch compatibility.
4710 Specifically, ``torch.full()`` does not accept integers as the shape argument
4711 (n.b. technically "size" in torch), but such behaviour is expected in internal
4712 code, so we copy the ``torch`` module and patch in a working ``full()`` function.
4713
4714 .. _v6.62.0:
4715
4716 -------------------
4717 6.62.0 - 2023-01-08
4718 -------------------
4719
4720 A classic error when testing is to write a test function that can never fail,
4721 even on inputs that aren't allowed or manually provided. By analogy to the
4722 design pattern of::
4723
4724 @pytest.mark.parametrize("arg", [
4725 ..., # passing examples
4726 pytest.param(..., marks=[pytest.mark.xfail]) # expected-failing input
4727 ])
4728
4729 we now support :obj:`@example(...).xfail() <hypothesis.example.xfail>`, with
4730 the same (optional) ``condition``, ``reason``, and ``raises`` arguments as
4731 ``pytest.mark.xfail()``.
4732
4733 Naturally you can also write ``.via(...).xfail(...)``, or ``.xfail(...).via(...)``,
4734 if you wish to note the provenance of expected-failing examples.
4735
4736 .. _v6.61.3:
4737
4738 -------------------
4739 6.61.3 - 2023-01-08
4740 -------------------
4741
4742 This patch teaches our enhanced :func:`~typing.get_type_hints` function to
4743 'see through' :obj:`~functools.partial` application, allowing inference
4744 from type hints to work in a few more cases which aren't (yet!) supported
4745 by the standard-library version.
4746
4747 .. _v6.61.2:
4748
4749 -------------------
4750 6.61.2 - 2023-01-07
4751 -------------------
4752
4753 This patch improves our pretty-printing of failing examples, including
4754 some refactoring to prepare for exciting future features.
4755
4756 .. _v6.61.1:
4757
4758 -------------------
4759 6.61.1 - 2023-01-06
4760 -------------------
4761
4762 This patch brings our :func:`~hypothesis.provisional.domains` and
4763 :func:`~hypothesis.strategies.emails` strategies into compliance with
4764 :rfc:`RFC 5890 §2.3.1 <5890>`: we no longer generate parts-of-domains
4765 where the third and fourth characters are ``--`` ("R-LDH labels"),
4766 though future versions *may* deliberately generate ``xn--`` punycode
4767 labels. Thanks to :pypi:`python-email-validator` for `the report
4768 <https://github.com/JoshData/python-email-validator/issues/92>`__!
4769
4770 .. _v6.61.0:
4771
4772 -------------------
4773 6.61.0 - 2022-12-11
4774 -------------------
4775
4776 This release improves our treatment of database keys, which based on (among other things)
4777 the source code of your test function. We now post-process this source to ignore
4778 decorators, comments, trailing whitespace, and blank lines - so that you can add
4779 :obj:`@example() <hypothesis.example>`\ s or make some small no-op edits to your code
4780 without preventing replay of any known failing or covering examples.
4781
4782 .. _v6.60.1:
4783
4784 -------------------
4785 6.60.1 - 2022-12-11
4786 -------------------
4787
4788 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
4789 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
4790
4791 .. _v6.60.0:
4792
4793 -------------------
4794 6.60.0 - 2022-12-04
4795 -------------------
4796
4797 This release improves Hypothesis' ability to resolve forward references in
4798 type annotations. It fixes a bug that prevented
4799 :func:`~hypothesis.strategies.builds` from being used with `pydantic models that
4800 possess updated forward references <https://pydantic-docs.helpmanual.io/usage/postponed_annotations/>`__. See :issue:`3519`.
4801
4802 .. _v6.59.0:
4803
4804 -------------------
4805 6.59.0 - 2022-12-02
4806 -------------------
4807
4808 The :obj:`@example(...) <hypothesis.example>` decorator now has a ``.via()``
4809 method, which future tools will use to track automatically-added covering
4810 examples (:issue:`3506`).
4811
4812 .. _v6.58.2:
4813
4814 -------------------
4815 6.58.2 - 2022-11-30
4816 -------------------
4817
4818 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
4819 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
4820
4821 .. _v6.58.1:
4822
4823 -------------------
4824 6.58.1 - 2022-11-26
4825 -------------------
4826
4827 This patch shifts ``hypothesis[lark]`` from depending on the old :pypi:`lark-parser`
4828 package to the new :pypi:`lark` package. There are no code changes in Hypothesis,
4829 it's just that Lark got a new name on PyPI for version 1.0 onwards.
4830
4831 .. _v6.58.0:
4832
4833 -------------------
4834 6.58.0 - 2022-11-19
4835 -------------------
4836
4837 :func:`~hypothesis.register_random` has used :mod:`weakref` since :ref:`v6.27.1`,
4838 allowing the :class:`~random.Random`-compatible objects to be garbage-collected when
4839 there are no other references remaining in order to avoid memory leaks.
4840 We now raise an error or emit a warning when this seems likely to happen immediately.
4841
4842 The type annotation of :func:`~hypothesis.register_random` was also widened so that
4843 structural subtypes of :class:`~random.Random` are accepted by static typecheckers.
4844
4845 .. _v6.57.1:
4846
4847 -------------------
4848 6.57.1 - 2022-11-14
4849 -------------------
4850
4851 This patch updates some internal type annotations and fixes a formatting bug in the
4852 :obj:`~hypothesis.Phase.explain` phase reporting.
4853
4854 .. _v6.57.0:
4855
4856 -------------------
4857 6.57.0 - 2022-11-14
4858 -------------------
4859
4860 Hypothesis now raises an error if you passed a strategy as the ``alphabet=``
4861 argument to :func:`~hypothesis.strategies.text`, and it generated something
4862 which was not a length-one string. This has never been supported, we're just
4863 adding explicit validation to catch cases like `this StackOverflow question
4864 <https://stackoverflow.com/a/74336909/9297601>`__.
4865
4866 .. _v6.56.4:
4867
4868 -------------------
4869 6.56.4 - 2022-10-28
4870 -------------------
4871
4872 This patch updates some docs, and depends on :pypi:`exceptiongroup` 1.0.0
4873 final to avoid a bug in the previous version.
4874
4875 .. _v6.56.3:
4876
4877 -------------------
4878 6.56.3 - 2022-10-17
4879 -------------------
4880
4881 This patch teaches :func:`~hypothesis.strategies.text` to rewrite a few more
4882 filter predicates (:issue:`3134`). You're unlikely to notice any change.
4883
4884 .. _v6.56.2:
4885
4886 -------------------
4887 6.56.2 - 2022-10-10
4888 -------------------
4889
4890 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
4891 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy, and fixes some
4892 incorrect examples in the docs for :func:`~hypothesis.extra.numpy.mutually_broadcastable_shapes`.
4893
4894 .. _v6.56.1:
4895
4896 -------------------
4897 6.56.1 - 2022-10-05
4898 -------------------
4899
4900 This patch improves the error message when Hypothesis detects "flush to zero"
4901 mode for floating-point: we now report which package(s) enabled this, which
4902 can make debugging much easier. See :issue:`3458` for details.
4903
4904 .. _v6.56.0:
4905
4906 -------------------
4907 6.56.0 - 2022-10-02
4908 -------------------
4909
4910 This release defines ``__bool__()`` on :class:`~hypothesis.strategies.SearchStrategy`.
4911 It always returns ``True``, like before, but also emits a warning to help with
4912 cases where you intended to draw a value (:issue:`3463`).
4913
4914 .. _v6.55.0:
4915
4916 -------------------
4917 6.55.0 - 2022-09-29
4918 -------------------
4919
4920 In preparation for `future versions of the Array API standard
4921 <https://data-apis.org/array-api/latest/future_API_evolution.html>`__,
4922 :func:`~hypothesis.extra.array_api.make_strategies_namespace` now accepts an
4923 optional ``api_version`` argument, which determines the version conformed to by
4924 the returned strategies namespace. If ``None``, the version of the passed array
4925 module ``xp`` is inferred.
4926
4927 This release also introduces :func:`xps.real_dtypes`. This is currently
4928 equivalent to the existing :func:`xps.numeric_dtypes` strategy, but exists
4929 because the latter is expected to include complex numbers in the next version of
4930 the standard.
4931
4932 .. _v6.54.6:
4933
4934 -------------------
4935 6.54.6 - 2022-09-18
4936 -------------------
4937
4938 If multiple explicit examples (from :obj:`@example() <hypothesis.example>`)
4939 raise a Skip exception, for consistency with generated examples we now re-raise
4940 the first instead of collecting them into an ExceptionGroup (:issue:`3453`).
4941
4942 .. _v6.54.5:
4943
4944 -------------------
4945 6.54.5 - 2022-09-05
4946 -------------------
4947
4948 This patch updates our autoformatting tools, improving our code style without any API changes.
4949
4950 .. _v6.54.4:
4951
4952 -------------------
4953 6.54.4 - 2022-08-20
4954 -------------------
4955
4956 This patch fixes some type annotations for Python 3.9 and earlier (:issue:`3397`),
4957 and teaches the |Phase.explain| phase about certain locations it should not
4958 bother reporting (:issue:`3439`).
4959
4960 .. _v6.54.3:
4961
4962 -------------------
4963 6.54.3 - 2022-08-12
4964 -------------------
4965
4966 This patch teaches the Ghostwriter an additional check for function
4967 and class locations that should make it use public APIs more often.
4968
4969 .. _v6.54.2:
4970
4971 -------------------
4972 6.54.2 - 2022-08-10
4973 -------------------
4974
4975 This patch fixes our workaround for `a pytest bug where the inner exceptions in
4976 an ExceptionGroup are not displayed <https://github.com/pytest-dev/pytest/issues/9159>`__
4977 (:issue:`3430`).
4978
4979 .. _v6.54.1:
4980
4981 -------------------
4982 6.54.1 - 2022-08-02
4983 -------------------
4984
4985 This patch makes ``FailedHealthCheck`` and ``DeadlineExceeded`` exceptions
4986 picklable, for compatibility with Django's parallel test runner (:issue:`3426`).
4987
4988 .. _v6.54.0:
4989
4990 -------------------
4991 6.54.0 - 2022-08-02
4992 -------------------
4993
4994 Reporting of :obj:`multiple failing examples <hypothesis.settings.report_multiple_bugs>`
4995 now uses the :pep:`654` `ExceptionGroup <https://docs.python.org/3.11/library/exceptions.html#ExceptionGroup>`__ type, which is provided by the
4996 :pypi:`exceptiongroup` backport on Python 3.10 and earlier (:issue:`3175`).
4997 ``hypothesis.errors.MultipleFailures`` is therefore deprecated.
4998
4999 Failing examples and other reports are now stored as :pep:`678` exception notes, which
5000 ensures that they will always appear together with the traceback and other information
5001 about their respective error.
5002
5003 .. _v6.53.0:
5004
5005 -------------------
5006 6.53.0 - 2022-07-25
5007 -------------------
5008
5009 :func:`~hypothesis.extra.django.from_field` now supports ``UsernameField``
5010 from :mod:`django.contrib.auth.forms`.
5011
5012 Thanks to Afonso Silva for reporting and working on :issue:`3417`.
5013
5014 .. _v6.52.4:
5015
5016 -------------------
5017 6.52.4 - 2022-07-22
5018 -------------------
5019
5020 This patch improves the error message when you pass filenames to the :command:`hypothesis write`
5021 CLI, which takes the name of a module or function (e.g. :command:`hypothesis write gzip` or
5022 :command:`hypothesis write package.some_function` rather than :command:`hypothesis write script.py`).
5023
5024 Thanks to Ed Rogers for implementing this as part of the SciPy 2022 sprints!
5025
5026 .. _v6.52.3:
5027
5028 -------------------
5029 6.52.3 - 2022-07-19
5030 -------------------
5031
5032 This patch ensures that the warning for non-interactive ``.example()``
5033 points to your code instead of Hypothesis internals (:issue:`3403`).
5034
5035 Thanks to @jameslamb for this fix.
5036
5037 .. _v6.52.2:
5038
5039 -------------------
5040 6.52.2 - 2022-07-19
5041 -------------------
5042
5043 This patch makes :func:`~hypothesis.strategies.integers` more likely to
5044 generate boundary values for large two-sided intervals (:issue:`2942`).
5045
5046 .. _v6.52.1:
5047
5048 -------------------
5049 6.52.1 - 2022-07-18
5050 -------------------
5051
5052 This patch adds filter rewriting for :func:`math.isfinite`, :func:`math.isinf`, and :func:`math.isnan`
5053 on :func:`~hypothesis.strategies.integers` or :func:`~hypothesis.strategies.floats` (:issue:`2701`).
5054
5055 Thanks to Sam Clamons at the SciPy Sprints!
5056
5057 .. _v6.52.0:
5058
5059 -------------------
5060 6.52.0 - 2022-07-18
5061 -------------------
5062
5063 This release adds the ``allow_subnormal`` argument to :func:`~hypothesis.strategies.complex_numbers` by
5064 applying it to each of the real and imaginary parts separately. Closes :issue:`3390`.
5065
5066 Thanks to Evan Tey for this fix.
5067
5068 .. _v6.51.0:
5069
5070 -------------------
5071 6.51.0 - 2022-07-17
5072 -------------------
5073
5074 Issue a deprecation warning if a function decorated with
5075 :func:`@composite <hypothesis.strategies.composite>`
5076 does not draw any values (:issue:`3384`).
5077
5078 Thanks to Grzegorz Zieba, Rodrigo Girão, and Thomas Ball for
5079 working on this at the EuroPython sprints!
5080
5081 .. _v6.50.1:
5082
5083 -------------------
5084 6.50.1 - 2022-07-09
5085 -------------------
5086
5087 This patch improves the error messages in :obj:`@example() <hypothesis.example>`
5088 argument validation following the recent release of :ref:`6.49.1 <v6.49.1>`.
5089
5090 .. _v6.50.0:
5091
5092 -------------------
5093 6.50.0 - 2022-07-09
5094 -------------------
5095
5096 This release allows :func:`~hypothesis.extra.numpy.from_dtype` to generate
5097 Unicode strings which cannot be encoded in UTF-8, but are valid in Numpy
5098 arrays (which use UTF-32).
5099
5100 This logic will only be used with :pypi:`numpy` >= 1.19, because earlier
5101 versions have `an issue <https://github.com/numpy/numpy/issues/15363>`__
5102 which led us to revert :ref:`Hypothesis 5.2 <v5.2.0>` last time!
5103
5104 .. _v6.49.1:
5105
5106 -------------------
5107 6.49.1 - 2022-07-05
5108 -------------------
5109
5110 This patch fixes some inconsistency between argument handling for
5111 :obj:`@example <hypothesis.example>` and :func:`@given <hypothesis.given>`
5112 (:issue:`2706 <2706#issuecomment-1168363177>`).
5113
5114 .. _v6.49.0:
5115
5116 -------------------
5117 6.49.0 - 2022-07-04
5118 -------------------
5119
5120 This release uses :pep:`612` :obj:`python:typing.ParamSpec` (or the
5121 :pypi:`typing-extensions` backport) to express the first-argument-removing
5122 behaviour of :func:`@st.composite <hypothesis.strategies.composite>`
5123 and signature-preservation of :func:`~hypothesis.strategies.functions`
5124 to IDEs, editor plugins, and static type checkers such as :pypi:`mypy`.
5125
5126 .. _v6.48.3:
5127
5128 -------------------
5129 6.48.3 - 2022-07-03
5130 -------------------
5131
5132 :func:`hypothesis.event` now works for hashable objects which do not
5133 support weakrefs, such as integers and tuples.
5134
5135 .. _v6.48.2:
5136
5137 -------------------
5138 6.48.2 - 2022-06-29
5139 -------------------
5140
5141 This patch tidies up some internal introspection logic, which will improve
5142 support for positional-only arguments in a future release (:issue:`2706`).
5143
5144 .. _v6.48.1:
5145
5146 -------------------
5147 6.48.1 - 2022-06-27
5148 -------------------
5149
5150 This release automatically rewrites some simple filters, such as
5151 ``floats().filter(lambda x: x >= 10)`` to the more efficient
5152 ``floats(min_value=10)``, based on the AST of the predicate.
5153
5154 We continue to recommend using the efficient form directly wherever
5155 possible, but this should be useful for e.g. :pypi:`pandera` "``Checks``"
5156 where you already have a simple predicate and translating manually
5157 is really annoying. See :issue:`2701` for details.
5158
5159 .. _v6.48.0:
5160
5161 -------------------
5162 6.48.0 - 2022-06-27
5163 -------------------
5164
5165 This release raises :class:`~unittest.SkipTest` for tests which never executed any
5166 examples, for example because the :obj:`~hypothesis.settings.phases` setting
5167 excluded the :obj:`~hypothesis.Phase.explicit`, :obj:`~hypothesis.Phase.reuse`,
5168 and :obj:`~hypothesis.Phase.generate` phases. This helps to avoid cases where
5169 broken tests appear to pass, because they didn't actually execute (:issue:`3328`).
5170
5171 .. _v6.47.5:
5172
5173 -------------------
5174 6.47.5 - 2022-06-25
5175 -------------------
5176
5177 This patch fixes type annotations that had caused the signature of
5178 :func:`@given <hypothesis.given>` to be partially-unknown to type-checkers for Python
5179 versions before 3.10.
5180
5181 .. _v6.47.4:
5182
5183 -------------------
5184 6.47.4 - 2022-06-23
5185 -------------------
5186
5187 This patch fixes :func:`~hypothesis.strategies.from_type` on Python 3.11,
5188 following `python/cpython#93754 <https://github.com/python/cpython/pull/93754/>`__.
5189
5190 .. _v6.47.3:
5191
5192 -------------------
5193 6.47.3 - 2022-06-15
5194 -------------------
5195
5196 This patch makes the :obj:`~hypothesis.HealthCheck.too_slow` health check more
5197 consistent with long :obj:`~hypothesis.settings.deadline` tests (:issue:`3367`)
5198 and fixes an install issue under :pypi:`pipenv` which was introduced in
5199 :ref:`Hypothesis 6.47.2 <v6.47.2>` (:issue:`3374`).
5200
5201 .. _v6.47.2:
5202
5203 -------------------
5204 6.47.2 - 2022-06-12
5205 -------------------
5206
5207 We now use the :pep:`654` `ExceptionGroup <https://docs.python.org/3.11/library/exceptions.html#ExceptionGroup>`__
5208 type - provided by the :pypi:`exceptiongroup` backport on older Pythons -
5209 to ensure that if multiple errors are raised in teardown, they will all propagate.
5210
5211 .. _v6.47.1:
5212
5213 -------------------
5214 6.47.1 - 2022-06-10
5215 -------------------
5216
5217 Our pretty-printer no longer sorts dictionary keys, since iteration order is
5218 stable in Python 3.7+ and this can affect reproducing examples (:issue:`3370`).
5219 This PR was kindly supported by `Ordina Pythoneers
5220 <https://www.ordina.nl/vakgebieden/python/>`__.
5221
5222 .. _v6.47.0:
5223
5224 -------------------
5225 6.47.0 - 2022-06-07
5226 -------------------
5227
5228 The :ref:`Ghostwriter <ghostwriter>` can now write tests for
5229 :obj:`@classmethod <classmethod>` or :obj:`@staticmethod <staticmethod>`
5230 methods, in addition to the existing support for functions and other callables
5231 (:issue:`3318`). Thanks to Cheuk Ting Ho for the patch.
5232
5233 .. _v6.46.11:
5234
5235 --------------------
5236 6.46.11 - 2022-06-02
5237 --------------------
5238
5239 Mention :func:`hypothesis.strategies.timezones`
5240 in the documentation of :func:`hypothesis.strategies.datetimes` for completeness.
5241
5242 Thanks to George Macon for this addition.
5243
5244 .. _v6.46.10:
5245
5246 --------------------
5247 6.46.10 - 2022-06-01
5248 --------------------
5249
5250 This release contains some small improvements to our documentation.
5251 Thanks to Felix Divo for his contribution!
5252
5253 .. _v6.46.9:
5254
5255 -------------------
5256 6.46.9 - 2022-05-25
5257 -------------------
5258
5259 This patch by Adrian Garcia Badaracco adds type annotations
5260 to some private internals (:issue:`3074`).
5261
5262 .. _v6.46.8:
5263
5264 -------------------
5265 6.46.8 - 2022-05-25
5266 -------------------
5267
5268 This patch by Phillip Schanely makes changes to the
5269 :func:`~hypothesis.strategies.floats` strategy when ``min_value`` or ``max_value`` is
5270 present.
5271 Hypothesis will now be capable of generating every representable value in the bounds.
5272 You may notice that hypothesis is more likely to test values near boundaries, and values
5273 that are very close to zero.
5274
5275 These changes also support future integrations with symbolic execution tools and fuzzers
5276 (:issue:`3086`).
5277
5278 .. _v6.46.7:
5279
5280 -------------------
5281 6.46.7 - 2022-05-19
5282 -------------------
5283
5284 This patch updates the type annotations for :func:`~hypothesis.strategies.tuples` and
5285 :func:`~hypothesis.strategies.one_of` so that type-checkers require its arguments to be
5286 positional-only, and so that it no longer fails under pyright-strict mode (see
5287 :issue:`3348`). Additional changes are made to Hypothesis' internals improve pyright
5288 scans.
5289
5290 .. _v6.46.6:
5291
5292 -------------------
5293 6.46.6 - 2022-05-18
5294 -------------------
5295
5296 This patch by Cheuk Ting Ho adds support for :pep:`655` ``Required`` and ``NotRequired`` as attributes of
5297 :obj:`~python:typing.TypedDict` in :func:`~hypothesis.strategies.from_type` (:issue:`3339`).
5298
5299 .. _v6.46.5:
5300
5301 -------------------
5302 6.46.5 - 2022-05-15
5303 -------------------
5304
5305 This patch fixes :func:`~hypothesis.extra.numpy.from_dtype` with long-precision
5306 floating-point datatypes (typecode ``g``; see :func:`numpy:numpy.typename`).
5307
5308 .. _v6.46.4:
5309
5310 -------------------
5311 6.46.4 - 2022-05-15
5312 -------------------
5313
5314 This patch improves some error messages for custom signatures
5315 containing invalid parameter names (:issue:`3317`).
5316
5317 .. _v6.46.3:
5318
5319 -------------------
5320 6.46.3 - 2022-05-11
5321 -------------------
5322
5323 This patch by Cheuk Ting Ho makes it an explicit error to call :func:`~hypothesis.strategies.from_type`
5324 or :func:`~hypothesis.strategies.register_type_strategy` with types that have no runtime instances (:issue:`3280`).
5325
5326 .. _v6.46.2:
5327
5328 -------------------
5329 6.46.2 - 2022-05-03
5330 -------------------
5331
5332 This patch fixes silently dropping examples when the :obj:`@example <hypothesis.example>`
5333 decorator is applied to itself (:issue:`3319`). This was always a weird pattern, but now it
5334 works. Thanks to Ray Sogata, Keeri Tramm, and Kevin Khuong for working on this patch!
5335
5336 .. _v6.46.1:
5337
5338 -------------------
5339 6.46.1 - 2022-05-01
5340 -------------------
5341
5342 This patch fixes a rare bug where we could incorrectly treat
5343 :obj:`~python:inspect.Parameter.empty` as a type annotation,
5344 if the callable had an explicitly assigned ``__signature__``.
5345
5346 .. _v6.46.0:
5347
5348 -------------------
5349 6.46.0 - 2022-05-01
5350 -------------------
5351
5352 This release adds an ``allow_nil`` argument to :func:`~hypothesis.strategies.uuids`,
5353 which you can use to... generate the nil UUID. Thanks to Shlok Gandhi for the patch!
5354
5355 .. _v6.45.4:
5356
5357 -------------------
5358 6.45.4 - 2022-05-01
5359 -------------------
5360
5361 This patch fixes some missing imports for certain :ref:`Ghostwritten <ghostwriter>`
5362 tests. Thanks to Mel Seto for fixing :issue:`3316`.
5363
5364 .. _v6.45.3:
5365
5366 -------------------
5367 6.45.3 - 2022-04-30
5368 -------------------
5369
5370 This patch teaches :ref:`the Ghostwriter <ghostwriter>` to recognize
5371 many more common argument names (:issue:`3311`).
5372
5373 .. _v6.45.2:
5374
5375 -------------------
5376 6.45.2 - 2022-04-29
5377 -------------------
5378
5379 This patch fixes :issue:`3314`, where Hypothesis would raise an internal
5380 error from :func:`~hypothesis.provisional.domains` or (only on Windows)
5381 from :func:`~hypothesis.strategies.timezones` in some rare circumstances
5382 where the installation was subtly broken.
5383
5384 Thanks to Munir Abdinur for this contribution.
5385
5386 .. _v6.45.1:
5387
5388 -------------------
5389 6.45.1 - 2022-04-27
5390 -------------------
5391
5392 This release fixes deprecation warnings about ``sre_compile`` and ``sre_parse``
5393 imports and ``importlib.resources`` usage when running Hypothesis on Python 3.11.
5394
5395 Thanks to Florian Bruhin for this contribution.
5396
5397 .. _v6.45.0:
5398
5399 -------------------
5400 6.45.0 - 2022-04-22
5401 -------------------
5402
5403 This release updates :func:`xps.indices` by introducing an ``allow_newaxis``
5404 argument, defaulting to ``False``. If ``allow_newaxis=True``, indices can be
5405 generated that add dimensions to arrays, which is achieved by the indexer
5406 containing ``None``. This change is to support a specification change that
5407 expand dimensions via indexing (`data-apis/array-api#408
5408 <https://github.com/data-apis/array-api/pull/408>`_).
5409
5410 .. _v6.44.0:
5411
5412 -------------------
5413 6.44.0 - 2022-04-21
5414 -------------------
5415
5416 This release adds a ``names`` argument to :func:`~hypothesis.extra.pandas.indexes`
5417 and :func:`~hypothesis.extra.pandas.series`, so that you can create Pandas
5418 objects with specific or varied names.
5419
5420 Contributed by Sam Watts.
5421
5422 .. _v6.43.3:
5423
5424 -------------------
5425 6.43.3 - 2022-04-18
5426 -------------------
5427
5428 This patch updates the type annotations for :func:`@given <hypothesis.given>`
5429 so that type-checkers will warn on mixed positional and keyword arguments,
5430 as well as fixing :issue:`3296`.
5431
5432 .. _v6.43.2:
5433
5434 -------------------
5435 6.43.2 - 2022-04-16
5436 -------------------
5437
5438 Fixed a type annotation for ``pyright --strict`` (:issue:`3287`).
5439
5440 .. _v6.43.1:
5441
5442 -------------------
5443 6.43.1 - 2022-04-13
5444 -------------------
5445
5446 This patch makes it an explicit error to call
5447 :func:`~hypothesis.strategies.register_type_strategy` with a
5448 `Pydantic GenericModel <https://docs.pydantic.dev/latest/concepts/models/#generic-models>`__
5449 and a callable, because ``GenericModel`` isn't actually a generic type at
5450 runtime and so you have to register each of the "parametrized versions"
5451 (actually subclasses!) manually. See :issue:`2940` for more details.
5452
5453 .. _v6.43.0:
5454
5455 -------------------
5456 6.43.0 - 2022-04-12
5457 -------------------
5458
5459 This release makes it an explicit error to apply
5460 :func:`@pytest.fixture <pytest:pytest.fixture>` to a function which has
5461 already been decorated with :func:`@given() <hypothesis.given>`. Previously,
5462 ``pytest`` would convert your test to a fixture, and then never run it.
5463
5464 .. _v6.42.3:
5465
5466 -------------------
5467 6.42.3 - 2022-04-10
5468 -------------------
5469
5470 This patch fixes :func:`~hypothesis.strategies.from_type` on a :obj:`~python:typing.TypedDict`
5471 with complex annotations, defined in a file using ``from __future__ import annotations``.
5472 Thanks to Katelyn Gigante for identifying and fixing this bug!
5473
5474 .. _v6.42.2:
5475
5476 -------------------
5477 6.42.2 - 2022-04-10
5478 -------------------
5479
5480 The Hypothesis pytest plugin was not outputting valid xunit2 nodes when
5481 ``--junit-xml`` was specified. This has been broken since Pytest 5.4, which
5482 changed the internal API for adding nodes to the junit report.
5483
5484 This also fixes the issue when using hypothesis with ``--junit-xml`` and
5485 ``pytest-xdist`` where the junit xml report would not be xunit2 compatible.
5486 Now, when using with ``pytest-xdist``, the junit report will just omit the
5487 ``<properties>`` node.
5488
5489 For more details, see `this pytest issue <https://github.com/pytest-dev/pytest/issues/1126#issuecomment-484581283>`__,
5490 `this pytest issue <https://github.com/pytest-dev/pytest/issues/7767#issuecomment-1082436256>`__,
5491 and :issue:`1935`.
5492
5493 Thanks to Brandon Chinn for this bug fix!
5494
5495 .. _v6.42.1:
5496
5497 -------------------
5498 6.42.1 - 2022-04-10
5499 -------------------
5500
5501 This patch fixes pretty-printing of regular expressions in Python 3.11.0a7, and
5502 updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,.
5503
5504 .. _v6.42.0:
5505
5506 -------------------
5507 6.42.0 - 2022-04-09
5508 -------------------
5509
5510 This release makes :func:`st.functions(pure=True) <hypothesis.strategies.functions>` less noisy (:issue:`3253`),
5511 and generally improves pretty-printing of functions.
5512
5513 .. _v6.41.0:
5514
5515 -------------------
5516 6.41.0 - 2022-04-01
5517 -------------------
5518
5519 This release changes the implementation of :const:`~hypothesis.infer` to be an alias
5520 for :obj:`python:Ellipsis`. E.g. ``@given(a=infer)`` is now equivalent to ``@given(a=...)``. Furthermore, ``@given(...)`` can now be specified so that
5521 :func:`@given <hypothesis.given>` will infer the strategies for *all* arguments of the
5522 decorated function based on its annotations.
5523
5524 .. _v6.40.3:
5525
5526 -------------------
5527 6.40.3 - 2022-04-01
5528 -------------------
5529
5530 This patch simplifies the repr of the strategies namespace returned in
5531 :func:`~hypothesis.extra.array_api.make_strategies_namespace`, e.g.
5532
5533 .. code-block:: pycon
5534
5535 >>> from hypothesis.extra.array_api import make_strategies_namespace
5536 >>> from numpy import array_api as xp
5537 >>> xps = make_strategies_namespace(xp)
5538 >>> xps
5539 make_strategies_namespace(numpy.array_api)
5540
5541 .. _v6.40.2:
5542
5543 -------------------
5544 6.40.2 - 2022-04-01
5545 -------------------
5546
5547 Fixed :func:`~hypothesis.strategies.from_type` support for
5548 :pep:`604` union types, like ``int | None`` (:issue:`3255`).
5549
5550 .. _v6.40.1:
5551
5552 -------------------
5553 6.40.1 - 2022-04-01
5554 -------------------
5555
5556 Fixed an internal error when :func:`~hypothesis.given` was passed a lambda.
5557
5558 .. _v6.40.0:
5559
5560 -------------------
5561 6.40.0 - 2022-03-29
5562 -------------------
5563
5564 :ref:`The Ghostwriter <ghostwriter>` can now write tests which check that
5565 two or more functions are equivalent on valid inputs, *or* raise the same
5566 type of exception for invalid inputs (:issue:`3267`).
5567
5568 .. _v6.39.6:
5569
5570 -------------------
5571 6.39.6 - 2022-03-27
5572 -------------------
5573
5574 This patch makes some quality-of-life improvements to the
5575 :ref:`Ghostwriter <ghostwriter>`: we guess the :func:`~hypothesis.strategies.text`
5576 strategy for arguments named ``text`` (...obvious in hindsight, eh?);
5577 and improved the error message if you accidentally left in a
5578 :func:`~hypothesis.strategies.nothing` or broke your :pypi:`rich` install.
5579
5580 .. _v6.39.5:
5581
5582 -------------------
5583 6.39.5 - 2022-03-26
5584 -------------------
5585
5586 This patch improves our error detection and message when Hypothesis is run
5587 on a Python implementation without support for ``-0.0``, which is required
5588 for the :func:`~hypothesis.strategies.floats` strategy but can be disabled by
5589 `unsafe compiler options <https://simonbyrne.github.io/notes/fastmath/>`__
5590 (:issue:`3265`).
5591
5592 .. _v6.39.4:
5593
5594 -------------------
5595 6.39.4 - 2022-03-17
5596 -------------------
5597
5598 This patch tweaks some internal formatting. There is no user-visible change.
5599
5600 .. _v6.39.3:
5601
5602 -------------------
5603 6.39.3 - 2022-03-07
5604 -------------------
5605
5606 If the :obj:`~hypothesis.Phase.shrink` phase is disabled, we now stop the
5607 :obj:`~hypothesis.Phase.generate` phase as soon as an error is found regardless
5608 of the value of the ``report_multiple_examples`` setting, since that's
5609 probably what you wanted (:issue:`3244`).
5610
5611 .. _v6.39.2:
5612
5613 -------------------
5614 6.39.2 - 2022-03-07
5615 -------------------
5616
5617 This patch clarifies rare error messages in
5618 :func:`~hypothesis.strategies.builds` (:issue:`3225`) and
5619 :func:`~hypothesis.strategies.floats` (:issue:`3207`).
5620
5621 .. _v6.39.1:
5622
5623 -------------------
5624 6.39.1 - 2022-03-03
5625 -------------------
5626
5627 This patch fixes a regression where the bound inner function
5628 (``your_test.hypothesis.inner_test``) would be invoked with positional
5629 arguments rather than passing them by name, which broke
5630 :pypi:`pytest-asyncio` (:issue:`3245`).
5631
5632 .. _v6.39.0:
5633
5634 -------------------
5635 6.39.0 - 2022-03-01
5636 -------------------
5637
5638 This release improves Hypothesis' handling of positional-only arguments,
5639 which are now allowed :func:`@st.composite <hypothesis.strategies.composite>`
5640 strategies.
5641
5642 On Python 3.8 and later, the first arguments to :func:`~hypothesis.strategies.builds`
5643 and :func:`~hypothesis.extra.django.from_model` are now natively positional-only.
5644 In cases which were already errors, the ``TypeError`` from incorrect usage will
5645 therefore be raises immediately when the function is called, rather than when
5646 the strategy object is used.
5647
5648 .. _v6.38.0:
5649
5650 -------------------
5651 6.38.0 - 2022-02-26
5652 -------------------
5653
5654 This release makes :func:`~hypothesis.strategies.floats` error *consistently* when
5655 your floating-point hardware has been configured to violate IEEE-754 for
5656 :wikipedia:`subnormal numbers <Subnormal_number>`, instead of
5657 only when an internal assertion was tripped (:issue:`3092`).
5658
5659 If this happens to you, passing ``allow_subnormal=False`` will suppress the explicit
5660 error. However, we strongly recommend fixing the root cause by disabling global-effect
5661 unsafe-math compiler options instead, or at least consulting e.g. Simon Byrne's
5662 `Beware of fast-math <https://simonbyrne.github.io/notes/fastmath/>`__ explainer first.
5663
5664 .. _v6.37.2:
5665
5666 -------------------
5667 6.37.2 - 2022-02-21
5668 -------------------
5669
5670 This patch fixes a bug in stateful testing, where returning a single value
5671 wrapped in :func:`~hypothesis.stateful.multiple` would be printed such that
5672 the assigned variable was a tuple rather than the single element
5673 (:issue:`3236`).
5674
5675 .. _v6.37.1:
5676
5677 -------------------
5678 6.37.1 - 2022-02-21
5679 -------------------
5680
5681 This patch fixes a warning under :pypi:`pytest` 7 relating to our
5682 rich traceback display logic (:issue:`3223`).
5683
5684 .. _v6.37.0:
5685
5686 -------------------
5687 6.37.0 - 2022-02-18
5688 -------------------
5689
5690 When distinguishing multiple errors, Hypothesis now looks at the inner
5691 exceptions of :pep:`654` ``ExceptionGroup``\ s.
5692
5693 .. _v6.36.2:
5694
5695 -------------------
5696 6.36.2 - 2022-02-13
5697 -------------------
5698
5699 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
5700 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
5701
5702 .. _v6.36.1:
5703
5704 -------------------
5705 6.36.1 - 2022-01-31
5706 -------------------
5707
5708 This patch fixes some deprecation warnings from :pypi:`pytest` 7.0,
5709 along with some code formatting and docs updates.
5710
5711 .. _v6.36.0:
5712
5713 -------------------
5714 6.36.0 - 2022-01-19
5715 -------------------
5716
5717 This release disallows using :obj:`python:typing.Final`
5718 with :func:`~hypothesis.strategies.from_type`
5719 and :func:`~hypothesis.strategies.register_type_strategy`.
5720
5721 Why?
5722 Because ``Final`` can only be used during ``class`` definition.
5723 We don't generate class attributes.
5724
5725 It also does not make sense as a runtime type on its own.
5726
5727 .. _v6.35.1:
5728
5729 -------------------
5730 6.35.1 - 2022-01-17
5731 -------------------
5732
5733 This patch fixes ``hypothesis write`` output highlighting with :pypi:`rich`
5734 version 12.0 and later.
5735
5736 .. _v6.35.0:
5737
5738 -------------------
5739 6.35.0 - 2022-01-08
5740 -------------------
5741
5742 This release disallows using :obj:`python:typing.ClassVar`
5743 with :func:`~hypothesis.strategies.from_type`
5744 and :func:`~hypothesis.strategies.register_type_strategy`.
5745
5746 Why?
5747 Because ``ClassVar`` can only be used during ``class`` definition.
5748 We don't generate class attributes.
5749
5750 It also does not make sense as a runtime type on its own.
5751
5752 .. _v6.34.2:
5753
5754 -------------------
5755 6.34.2 - 2022-01-05
5756 -------------------
5757
5758 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
5759 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
5760
5761 .. _v6.34.1:
5762
5763 -------------------
5764 6.34.1 - 2021-12-31
5765 -------------------
5766
5767 This patch fixes :issue:`3169`, an extremely rare bug which would
5768 trigger if an internal least-recently-reused cache dropped a newly
5769 added entry immediately after it was added.
5770
5771 .. _v6.34.0:
5772
5773 -------------------
5774 6.34.0 - 2021-12-31
5775 -------------------
5776
5777 This release fixes :issue:`3133` and :issue:`3144`, where attempting
5778 to generate Pandas series of lists or sets would fail with confusing
5779 errors if you did not specify ``dtype=object``.
5780
5781 .. _v6.33.0:
5782
5783 -------------------
5784 6.33.0 - 2021-12-30
5785 -------------------
5786
5787 This release disallows using :obj:`python:typing.TypeAlias`
5788 with :func:`~hypothesis.strategies.from_type`
5789 and :func:`~hypothesis.strategies.register_type_strategy`.
5790
5791 Why? Because ``TypeAlias`` is not really a type,
5792 it is a tag for type checkers that some expression is a type alias,
5793 not something else.
5794
5795 It does not make sense for Hypothesis to resolve it as a strategy.
5796 References :issue:`2978`.
5797
5798 .. _v6.32.1:
5799
5800 -------------------
5801 6.32.1 - 2021-12-23
5802 -------------------
5803
5804 This patch updates our autoformatting tools, improving our code style without any API changes.
5805
5806 .. _v6.32.0:
5807
5808 -------------------
5809 6.32.0 - 2021-12-23
5810 -------------------
5811
5812 This release drops support for Python 3.6, which `reached end of life upstream
5813 <https://devguide.python.org/#status-of-python-branches>`__ on 2021-12-23.
5814
5815 .. _v6.31.6:
5816
5817 -------------------
5818 6.31.6 - 2021-12-15
5819 -------------------
5820
5821 This patch adds a temporary hook for a downstream tool,
5822 which is not part of the public API.
5823
5824 .. _v6.31.5:
5825
5826 -------------------
5827 6.31.5 - 2021-12-14
5828 -------------------
5829
5830 This release updates our copyright headers to `use a general authorship statement and omit the year
5831 <https://www.linuxfoundation.org/blog/copyright-notices-in-open-source-software-projects/>`__.
5832
5833 .. _v6.31.4:
5834
5835 -------------------
5836 6.31.4 - 2021-12-11
5837 -------------------
5838
5839 This patch makes the ``.example()`` method more representative of
5840 test-time data generation, albeit often at a substantial cost to
5841 readability (:issue:`3182`).
5842
5843 .. _v6.31.3:
5844
5845 -------------------
5846 6.31.3 - 2021-12-10
5847 -------------------
5848
5849 This patch improves annotations on some of Hypothesis' internal functions, in order to
5850 deobfuscate the signatures of some strategies. In particular, strategies shared between
5851 :ref:`hypothesis.extra.numpy <hypothesis-numpy>` and
5852 :ref:`the hypothesis.extra.array_api extra <array-api>` will benefit from this patch.
5853
5854 .. _v6.31.2:
5855
5856 -------------------
5857 6.31.2 - 2021-12-10
5858 -------------------
5859
5860 This patch fix invariants display in stateful falsifying examples (:issue:`3185`).
5861
5862 .. _v6.31.1:
5863
5864 -------------------
5865 6.31.1 - 2021-12-10
5866 -------------------
5867
5868 This patch updates :func:`xps.indices` so no flat indices are generated, i.e.
5869 generated indices will now always explicitly cover each axes of an array if no
5870 ellipsis is present. This is to be consistent with a specification change that
5871 dropped support for flat indexing
5872 (`#272 <https://github.com/data-apis/array-api/pull/272>`_).
5873
5874 .. _v6.31.0:
5875
5876 -------------------
5877 6.31.0 - 2021-12-09
5878 -------------------
5879
5880 This release makes us compatible with :pypi:`Django` 4.0, in particular by adding
5881 support for use of :mod:`zoneinfo` timezones (though we respect the new
5882 ``USE_DEPRECATED_PYTZ`` setting if you need it).
5883
5884 .. _v6.30.1:
5885
5886 -------------------
5887 6.30.1 - 2021-12-05
5888 -------------------
5889
5890 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
5891 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
5892
5893 .. _v6.30.0:
5894
5895 -------------------
5896 6.30.0 - 2021-12-03
5897 -------------------
5898
5899 This release adds an ``allow_subnormal`` argument to the
5900 :func:`~hypothesis.strategies.floats` strategy, which can explicitly toggle the
5901 generation of :wikipedia:`subnormal floats <Subnormal_number>` (:issue:`3155`).
5902 Disabling such generation is useful when testing flush-to-zero builds of
5903 libraries.
5904
5905 :func:`nps.from_dtype() <hypothesis.extra.numpy.from_dtype>` and
5906 :func:`xps.from_dtype` can also accept the ``allow_subnormal`` argument, and
5907 :func:`xps.from_dtype` or :func:`xps.arrays` will disable subnormals by default
5908 if the array module ``xp`` is detected to flush-to-zero (like is typical with
5909 CuPy).
5910
5911 .. _v6.29.3:
5912
5913 -------------------
5914 6.29.3 - 2021-12-02
5915 -------------------
5916
5917 This patch fixes a bug in :func:`~hypothesis.extra.numpy.mutually_broadcastable_shapes`,
5918 which restricted the patterns of singleton dimensions that could be generated for
5919 dimensions that extended beyond ``base_shape`` (:issue:`3170`).
5920
5921 .. _v6.29.2:
5922
5923 -------------------
5924 6.29.2 - 2021-12-02
5925 -------------------
5926
5927 This patch clarifies our pretty-printing of DataFrames (:issue:`3114`).
5928
5929 .. _v6.29.1:
5930
5931 -------------------
5932 6.29.1 - 2021-12-02
5933 -------------------
5934
5935 This patch documents :func:`~hypothesis.strategies.timezones`
5936 `Windows-only requirement <https://docs.python.org/3/library/zoneinfo.html#data-sources>`__
5937 for the :pypi:`tzdata` package, and ensures that
5938 ``pip install hypothesis[zoneinfo]`` will install the latest version.
5939
5940 .. _v6.29.0:
5941
5942 -------------------
5943 6.29.0 - 2021-11-29
5944 -------------------
5945
5946 This release teaches :func:`~hypothesis.strategies.builds` to use
5947 :func:`~hypothesis.strategies.deferred` when resolving unrecognised type hints,
5948 so that you can conveniently register strategies for recursive types
5949 with constraints on some arguments (:issue:`3026`):
5950
5951 .. code-block:: python
5952
5953 class RecursiveClass:
5954 def __init__(self, value: int, next_node: typing.Optional["SomeClass"]):
5955 assert value > 0
5956 self.value = value
5957 self.next_node = next_node
5958
5959 st.register_type_strategy(
5960 RecursiveClass, st.builds(RecursiveClass, value=st.integers(min_value=1))
5961 )
5962
5963 .. _v6.28.1:
5964
5965 -------------------
5966 6.28.1 - 2021-11-28
5967 -------------------
5968
5969 This release fixes some internal calculations related to collection sizes (:issue:`3143`).
5970
5971 .. _v6.28.0:
5972
5973 -------------------
5974 6.28.0 - 2021-11-28
5975 -------------------
5976
5977 This release modifies our :pypi:`pytest` plugin, to avoid importing Hypothesis
5978 and therefore triggering :ref:`Hypothesis' entry points <entry-points>` for
5979 test suites where Hypothesis is installed but not actually used (:issue:`3140`).
5980
5981 .. _v6.27.3:
5982
5983 -------------------
5984 6.27.3 - 2021-11-28
5985 -------------------
5986
5987 This release fixes :issue:`3080`, where :func:`~hypothesis.strategies.from_type`
5988 failed on unions containing :pep:`585` builtin generic types (like ``list[int]``)
5989 in Python 3.9 and later.
5990
5991 .. _v6.27.2:
5992
5993 -------------------
5994 6.27.2 - 2021-11-26
5995 -------------------
5996
5997 This patch makes the :command:`hypothesis codemod`
5998 :ref:`command <hypothesis-cli>` somewhat faster.
5999
6000 .. _v6.27.1:
6001
6002 -------------------
6003 6.27.1 - 2021-11-22
6004 -------------------
6005
6006 This patch changes the backing datastructures of :func:`~hypothesis.register_random`
6007 and a few internal caches to use :class:`weakref.WeakValueDictionary`. This reduces
6008 memory usage and may improve performance when registered :class:`~random.Random`
6009 instances are only used for a subset of your tests (:issue:`3131`).
6010
6011 .. _v6.27.0:
6012
6013 -------------------
6014 6.27.0 - 2021-11-22
6015 -------------------
6016
6017 This release teaches Hypothesis' multiple-error reporting to format tracebacks
6018 using :pypi:`pytest` or :pypi:`better-exceptions`, if they are installed and
6019 enabled (:issue:`3116`).
6020
6021 .. _v6.26.0:
6022
6023 -------------------
6024 6.26.0 - 2021-11-21
6025 -------------------
6026
6027 Did you know that of the 2\ :superscript:`64` possible floating-point numbers,
6028 2\ :superscript:`53` of them are ``nan`` - and Python prints them all the same way?
6029
6030 While nans *usually* have all zeros in the sign bit and mantissa, this
6031 `isn't always true <https://wingolog.org/archives/2011/05/18/value-representation-in-javascript-implementations>`__,
6032 and :wikipedia:`'signaling' nans might trap or error <NaN#Signaling_NaN>`.
6033 To help distinguish such errors in e.g. CI logs, Hypothesis now prints ``-nan`` for
6034 negative nans, and adds a comment like ``# Saw 3 signaling NaNs`` if applicable.
6035
6036 .. _v6.25.0:
6037
6038 -------------------
6039 6.25.0 - 2021-11-19
6040 -------------------
6041
6042 This release adds special filtering logic to make a few special cases
6043 like ``s.map(lambda x: x)`` and ``lists().filter(len)`` more efficient
6044 (:issue:`2701`).
6045
6046 .. _v6.24.6:
6047
6048 -------------------
6049 6.24.6 - 2021-11-18
6050 -------------------
6051
6052 This patch makes :func:`~hypothesis.strategies.floats` generate
6053 :wikipedia:`"subnormal" floating point numbers <Subnormal_number>`
6054 more often, as these rare values can have strange interactions with
6055 `unsafe compiler optimisations like -ffast-math
6056 <https://simonbyrne.github.io/notes/fastmath/#flushing_subnormals_to_zero>`__
6057 (:issue:`2976`).
6058
6059 .. _v6.24.5:
6060
6061 -------------------
6062 6.24.5 - 2021-11-16
6063 -------------------
6064
6065 This patch fixes a rare internal error in the :func:`~hypothesis.strategies.datetimes`
6066 strategy, where the implementation of ``allow_imaginary=False`` crashed when checking
6067 a time during the skipped hour of a DST transition *if* the DST offset is negative -
6068 only true of ``Europe/Dublin``, who we presume have their reasons - and the ``tzinfo``
6069 object is a :pypi:`pytz` timezone (which predates :pep:`495`).
6070
6071 .. _v6.24.4:
6072
6073 -------------------
6074 6.24.4 - 2021-11-15
6075 -------------------
6076
6077 This patch gives Hypothesis it's own internal :class:`~random.Random` instance,
6078 ensuring that test suites which reset the global random state don't induce
6079 weird correlations between property-based tests (:issue:`2135`).
6080
6081 .. _v6.24.3:
6082
6083 -------------------
6084 6.24.3 - 2021-11-13
6085 -------------------
6086
6087 This patch updates documentation of :func:`~hypothesis.note`
6088 (:issue:`3147`).
6089
6090 .. _v6.24.2:
6091
6092 -------------------
6093 6.24.2 - 2021-11-05
6094 -------------------
6095
6096 This patch updates internal testing for the :ref:`Array API extra <array-api>`
6097 to be consistent with new specification changes: ``sum()`` not accepting
6098 boolean arrays (`#234 <https://github.com/data-apis/array-api/pull/234>`_),
6099 ``unique()`` split into separate functions
6100 (`#275 <https://github.com/data-apis/array-api/pull/275>`_), and treating NaNs
6101 as distinct (`#310 <https://github.com/data-apis/array-api/pull/310>`_). It has
6102 no user visible impact.
6103
6104 .. _v6.24.1:
6105
6106 -------------------
6107 6.24.1 - 2021-11-01
6108 -------------------
6109
6110 This patch updates our vendored `list of top-level domains <https://www.iana.org/domains/root/db>`__,
6111 which is used by the provisional :func:`~hypothesis.provisional.domains` strategy.
6112
6113 .. _v6.24.0:
6114
6115 -------------------
6116 6.24.0 - 2021-10-23
6117 -------------------
6118
6119 This patch updates our vendored `list of top-level domains
6120 <https://data.iana.org/TLD/tlds-alpha-by-domain.txt>`__, which is used
6121 by the provisional :func:`~hypothesis.provisional.domains` strategy.
6122
6123 (did you know that gTLDs can be both `added <https://newgtlds.icann.org/en/>`__
6124 and `removed <https://www.icann.org/resources/pages/gtld-registry-agreement-termination-2015-10-09-en>`__?)
6125
6126 .. _v6.23.4:
6127
6128 -------------------
6129 6.23.4 - 2021-10-20
6130 -------------------
6131
6132 This patch adds an error for when ``shapes`` in :func:`xps.arrays()` is not
6133 passed as either a valid shape or strategy.
6134
6135 .. _v6.23.3:
6136
6137 -------------------
6138 6.23.3 - 2021-10-18
6139 -------------------
6140
6141 This patch updates our formatting with :pypi:`shed`.
6142
6143 .. _v6.23.2:
6144
6145 -------------------
6146 6.23.2 - 2021-10-08
6147 -------------------
6148
6149 This patch replaces external links to :doc:`NumPy <numpy:index>` API docs
6150 with :mod:`sphinx.ext.intersphinx` cross-references. It is purely a documentation improvement.
6151
6152 .. _v6.23.1:
6153
6154 -------------------
6155 6.23.1 - 2021-09-29
6156 -------------------
6157
6158 This patch cleans up internal logic for :func:`xps.arrays()`. There is no
6159 user-visible change.
6160
6161 .. _v6.23.0:
6162
6163 -------------------
6164 6.23.0 - 2021-09-26
6165 -------------------
6166
6167 This release follows :pypi:`pytest` in considering :class:`SystemExit` and
6168 :class:`GeneratorExit` exceptions to be test failures, meaning that we will
6169 shink to minimal examples and check for flakiness even though they subclass
6170 :class:`BaseException` directly (:issue:`2223`).
6171
6172 :class:`KeyboardInterrupt` continues to interrupt everything, and will be
6173 re-raised immediately.
6174
6175 .. _v6.22.0:
6176
6177 -------------------
6178 6.22.0 - 2021-09-24
6179 -------------------
6180
6181 This release adds :class:`~hypothesis.extra.django.LiveServerTestCase` and
6182 :class:`~hypothesis.extra.django.StaticLiveServerTestCase` for django test.
6183 Thanks to Ivan Tham for this feature!
6184
6185 .. _v6.21.6:
6186
6187 -------------------
6188 6.21.6 - 2021-09-19
6189 -------------------
6190
6191 This patch fixes some new linter warnings such as :pypi:`flake8-bugbear`'s
6192 ``B904`` for explicit exception chaining, so tracebacks might be a bit nicer.
6193
6194 .. _v6.21.5:
6195
6196 -------------------
6197 6.21.5 - 2021-09-16
6198 -------------------
6199
6200 This release fixes ``None`` being inferred as the float64 dtype in
6201 :func:`~xps.from_dtype()` and :func:`~xps.arrays()` from the
6202 :ref:`Array API extra <array-api>`.
6203
6204 .. _v6.21.4:
6205
6206 -------------------
6207 6.21.4 - 2021-09-16
6208 -------------------
6209
6210 This release fixes the type hint for the
6211 :func:`@given() <hypothesis.given>` decorator
6212 when decorating an ``async`` function (:issue:`3099`).
6213
6214 .. _v6.21.3:
6215
6216 -------------------
6217 6.21.3 - 2021-09-15
6218 -------------------
6219
6220 This release improves Ghostwritten tests for builtins (:issue:`2977`).
6221
6222 .. _v6.21.2:
6223
6224 -------------------
6225 6.21.2 - 2021-09-15
6226 -------------------
6227
6228 This release deprecates use of both ``min_dims > len(shape)`` and
6229 ``max_dims > len(shape)`` when ``allow_newaxis == False`` in
6230 :func:`~hypothesis.extra.numpy.basic_indices` (:issue:`3091`).
6231
6232 .. _v6.21.1:
6233
6234 -------------------
6235 6.21.1 - 2021-09-13
6236 -------------------
6237
6238 This release improves the behaviour of :func:`~hypothesis.strategies.builds`
6239 and :func:`~hypothesis.strategies.from_type` in certain situations involving
6240 decorators (:issue:`2495` and :issue:`3029`).
6241
6242 .. _v6.21.0:
6243
6244 -------------------
6245 6.21.0 - 2021-09-11
6246 -------------------
6247
6248 This release introduces strategies for array/tensor libraries adopting the
6249 `Array API standard <https://data-apis.org/>`__ (:issue:`3037`).
6250 They are available in :ref:`the hypothesis.extra.array_api extra <array-api>`,
6251 and work much like the existing :ref:`strategies for NumPy <hypothesis-numpy>`.
6252
6253 .. _v6.20.1:
6254
6255 -------------------
6256 6.20.1 - 2021-09-10
6257 -------------------
6258
6259 This patch fixes :issue:`961`, where calling ``given()`` inline on a
6260 bound method would fail to handle the ``self`` argument correctly.
6261
6262 .. _v6.20.0:
6263
6264 -------------------
6265 6.20.0 - 2021-09-09
6266 -------------------
6267
6268 This release allows :func:`~hypothesis.strategies.slices` to generate ``step=None``,
6269 and fixes an off-by-one error where the ``start`` index could be equal to ``size``.
6270 This works fine for all Python sequences and Numpy arrays, but is undefined behaviour
6271 in the `Array API standard <https://data-apis.org/>`__ (see :pull:`3065`).
6272
6273 .. _v6.19.0:
6274
6275 -------------------
6276 6.19.0 - 2021-09-08
6277 -------------------
6278
6279 This release makes :ref:`stateful testing <stateful>` more likely to tell you
6280 if you do something unexpected and unsupported:
6281
6282 - The :obj:`~hypothesis.HealthCheck.return_value` health check now applies to
6283 :func:`~hypothesis.stateful.rule` and :func:`~hypothesis.stateful.initialize`
6284 rules, if they don't have ``target`` bundles, as well as
6285 :func:`~hypothesis.stateful.invariant`.
6286 - Using a :func:`~hypothesis.stateful.consumes` bundle as a ``target`` is
6287 deprecated, and will be an error in a future version.
6288
6289 If existing code triggers these new checks, check for related bugs and
6290 misunderstandings - these patterns *never* had any effect.
6291
6292 .. _v6.18.0:
6293
6294 -------------------
6295 6.18.0 - 2021-09-06
6296 -------------------
6297
6298 This release teaches :func:`~hypothesis.strategies.from_type` a neat trick:
6299 when resolving an :obj:`python:typing.Annotated` type, if one of the annotations
6300 is a strategy object we use that as the inferred strategy. For example:
6301
6302 .. code-block:: python
6303
6304 PositiveInt = Annotated[int, st.integers(min_value=1)]
6305
6306 If there are multiple strategies, we use the last outer-most annotation.
6307 See :issue:`2978` and :pull:`3082` for discussion.
6308
6309 *Requires Python 3.9 or later for*
6310 :func:`get_type_hints(..., include_extras=False) <typing.get_type_hints>`.
6311
6312 .. _v6.17.4:
6313
6314 -------------------
6315 6.17.4 - 2021-08-31
6316 -------------------
6317
6318 This patch makes unique :func:`~hypothesis.extra.numpy.arrays` much more
6319 efficient, especially when there are only a few valid elements - such as
6320 for eight-bit integers (:issue:`3066`).
6321
6322 .. _v6.17.3:
6323
6324 -------------------
6325 6.17.3 - 2021-08-30
6326 -------------------
6327
6328 This patch fixes the repr of :func:`~hypothesis.extra.numpy.array_shapes`.
6329
6330 .. _v6.17.2:
6331
6332 -------------------
6333 6.17.2 - 2021-08-30
6334 -------------------
6335
6336 This patch wraps some internal helper code in our proxies decorator to prevent
6337 mutations of method docstrings carrying over to other instances of the respective
6338 methods.
6339
6340 .. _v6.17.1:
6341
6342 -------------------
6343 6.17.1 - 2021-08-29
6344 -------------------
6345
6346 This patch moves some internal helper code in preparation for :issue:`3065`.
6347 There is no user-visible change, unless you depended on undocumented internals.
6348
6349 .. _v6.17.0:
6350
6351 -------------------
6352 6.17.0 - 2021-08-27
6353 -------------------
6354
6355 This release adds type annotations to the :ref:`stateful testing <stateful>` API.
6356
6357 Thanks to Ruben Opdebeeck for this contribution!
6358
6359 .. _v6.16.0:
6360
6361 -------------------
6362 6.16.0 - 2021-08-27
6363 -------------------
6364
6365 This release adds the :class:`~hypothesis.strategies.DrawFn` type as a reusable
6366 type hint for the ``draw`` argument of
6367 :func:`@composite <hypothesis.strategies.composite>` functions.
6368
6369 Thanks to Ruben Opdebeeck for this contribution!
6370
6371 .. _v6.15.0:
6372
6373 -------------------
6374 6.15.0 - 2021-08-22
6375 -------------------
6376
6377 This release emits a more useful error message when :func:`@given() <hypothesis.given>`
6378 is applied to a coroutine function, i.e. one defined using ``async def`` (:issue:`3054`).
6379
6380 This was previously only handled by the generic :obj:`~hypothesis.HealthCheck.return_value`
6381 health check, which doesn't direct you to use either :ref:`a custom executor <custom-function-execution>`
6382 or a library such as :pypi:`pytest-trio` or :pypi:`pytest-asyncio` to handle it for you.
6383
6384 .. _v6.14.9:
6385
6386 -------------------
6387 6.14.9 - 2021-08-20
6388 -------------------
6389
6390 This patch fixes a regression in Hypothesis 6.14.8, where :func:`~hypothesis.strategies.from_type`
6391 failed to resolve types which inherit from multiple parametrised generic types,
6392 affecting the :pypi:`returns` package (:issue:`3060`).
6393
6394 .. _v6.14.8:
6395
6396 -------------------
6397 6.14.8 - 2021-08-16
6398 -------------------
6399
6400 This patch ensures that registering a strategy for a subclass of a parametrised
6401 generic type such as ``class Lines(Sequence[str]):`` will not "leak" into unrelated
6402 strategies such as ``st.from_type(Sequence[int])`` (:issue:`2951`).
6403 Unfortunately this fix requires :pep:`560`, meaning Python 3.7 or later.
6404
6405 .. _v6.14.7:
6406
6407 -------------------
6408 6.14.7 - 2021-08-14
6409 -------------------
6410
6411 This patch fixes :issue:`3050`, where :pypi:`attrs` classes could
6412 cause an internal error in the :ref:`ghostwriter <ghostwriter>`.
6413
6414 .. _v6.14.6:
6415
6416 -------------------
6417 6.14.6 - 2021-08-07
6418 -------------------
6419
6420 This patch improves the error message for :issue:`3016`, where :pep:`585`
6421 builtin generics with self-referential forward-reference strings cannot be
6422 resolved to a strategy by :func:`~hypothesis.strategies.from_type`.
6423
6424 .. _v6.14.5:
6425
6426 -------------------
6427 6.14.5 - 2021-07-27
6428 -------------------
6429
6430 This patch fixes ``hypothesis.strategies._internal.types.is_a_new_type``.
6431 It was failing on Python ``3.10.0b4``, where ``NewType`` is a function.
6432
6433 .. _v6.14.4:
6434
6435 -------------------
6436 6.14.4 - 2021-07-26
6437 -------------------
6438
6439 This patch fixes :func:`~hypothesis.strategies.from_type` and
6440 :func:`~hypothesis.strategies.register_type_strategy` for
6441 :obj:`python:typing.NewType` on Python 3.10, which changed the
6442 underlying implementation (see :bpo:`44353` for details).
6443
6444 .. _v6.14.3:
6445
6446 -------------------
6447 6.14.3 - 2021-07-18
6448 -------------------
6449
6450 This patch updates our autoformatting tools, improving our code style without any API changes.
6451
6452 .. _v6.14.2:
6453
6454 -------------------
6455 6.14.2 - 2021-07-12
6456 -------------------
6457
6458 This patch ensures that we shorten tracebacks for tests which fail due
6459 to inconsistent data generation between runs (i.e. raise ``Flaky``).
6460
6461 .. _v6.14.1:
6462
6463 -------------------
6464 6.14.1 - 2021-07-02
6465 -------------------
6466
6467 This patch updates some internal type annotations.
6468 There is no user-visible change.
6469
6470 .. _v6.14.0:
6471
6472 -------------------
6473 6.14.0 - 2021-06-09
6474 -------------------
6475
6476 The |Phase.explain| phase now requires shrinking to be enabled,
6477 and will be automatically skipped for deadline-exceeded errors.
6478
6479 .. _v6.13.14:
6480
6481 --------------------
6482 6.13.14 - 2021-06-04
6483 --------------------
6484
6485 This patch improves the :func:`~hypothesis.strategies.tuples` strategy
6486 type annotations, to preserve the element types for up to length-five
6487 tuples (:issue:`3005`).
6488
6489 As for :func:`~hypothesis.strategies.one_of`, this is the best we can do
6490 before a `planned extension <https://mail.python.org/archives/list/[email protected]/thread/LOQFV3IIWGFDB7F5BDX746EZJG4VVBI3/>`__
6491 to :pep:`646` is released, hopefully in Python 3.11.
6492
6493 .. _v6.13.13:
6494
6495 --------------------
6496 6.13.13 - 2021-06-04
6497 --------------------
6498
6499 This patch teaches :ref:`the Ghostwriter <ghostwriter>` how to find
6500 :doc:`custom ufuncs <numpy:reference/ufuncs>` from *any* module that defines them,
6501 and that ``yaml.unsafe_load()`` does not undo ``yaml.safe_load()``.
6502
6503 .. _v6.13.12:
6504
6505 --------------------
6506 6.13.12 - 2021-06-03
6507 --------------------
6508
6509 This patch reduces the amount of internal code excluded from our test suite's
6510 code coverage checks.
6511
6512 There is no user-visible change.
6513
6514 .. _v6.13.11:
6515
6516 --------------------
6517 6.13.11 - 2021-06-02
6518 --------------------
6519
6520 This patch removes some old internal helper code that previously existed
6521 to make Python 2 compatibility easier.
6522
6523 There is no user-visible change.
6524
6525 .. _v6.13.10:
6526
6527 --------------------
6528 6.13.10 - 2021-05-30
6529 --------------------
6530
6531 This release adjusts some internal code to help make our test suite more
6532 reliable.
6533
6534 There is no user-visible change.
6535
6536 .. _v6.13.9:
6537
6538 -------------------
6539 6.13.9 - 2021-05-30
6540 -------------------
6541
6542 This patch cleans up some internal code related to filtering strategies.
6543
6544 There is no user-visible change.
6545
6546 .. _v6.13.8:
6547
6548 -------------------
6549 6.13.8 - 2021-05-28
6550 -------------------
6551
6552 This patch slightly improves the performance of some internal code for
6553 generating integers.
6554
6555 .. _v6.13.7:
6556
6557 -------------------
6558 6.13.7 - 2021-05-27
6559 -------------------
6560
6561 This patch fixes a bug in :func:`~hypothesis.strategies.from_regex` that
6562 caused ``from_regex("", fullmatch=True)`` to unintentionally generate non-empty
6563 strings (:issue:`4982`).
6564
6565 The only strings that completely match an empty regex pattern are empty
6566 strings.
6567
6568 .. _v6.13.6:
6569
6570 -------------------
6571 6.13.6 - 2021-05-26
6572 -------------------
6573
6574 This patch fixes a bug that caused :func:`~hypothesis.strategies.integers`
6575 to shrink towards negative values instead of positive values in some cases.
6576
6577 .. _v6.13.5:
6578
6579 -------------------
6580 6.13.5 - 2021-05-24
6581 -------------------
6582
6583 This patch fixes rare cases where ``hypothesis write --binary-op`` could
6584 print :ref:`reproducing instructions <reproducing-inputs>` from the internal
6585 search for an identity element.
6586
6587 .. _v6.13.4:
6588
6589 -------------------
6590 6.13.4 - 2021-05-24
6591 -------------------
6592
6593 This patch removes some unnecessary intermediate list-comprehensions,
6594 using the latest versions of :pypi:`pyupgrade` and :pypi:`shed`.
6595
6596 .. _v6.13.3:
6597
6598 -------------------
6599 6.13.3 - 2021-05-23
6600 -------------------
6601
6602 This patch adds a ``.hypothesis`` property to invalid test functions, bringing
6603 them inline with valid tests and fixing a bug where :pypi:`pytest-asyncio` would
6604 swallow the real error message and mistakenly raise a version incompatibility
6605 error.
6606
6607 .. _v6.13.2:
6608
6609 -------------------
6610 6.13.2 - 2021-05-23
6611 -------------------
6612
6613 Some of Hypothesis's numpy/pandas strategies use a ``fill`` argument to speed
6614 up generating large arrays, by generating a single fill value and sharing that
6615 value among many array slots instead of filling every single slot individually.
6616
6617 When no ``fill`` argument is provided, Hypothesis tries to detect whether it is
6618 OK to automatically use the ``elements`` argument as a fill strategy, so that
6619 it can still use the faster approach.
6620
6621 This patch fixes a bug that would cause that optimization to trigger in some
6622 cases where it isn't 100% guaranteed to be OK.
6623
6624 If this makes some of your numpy/pandas tests run more slowly, try adding an
6625 explicit ``fill`` argument to the relevant strategies to ensure that Hypothesis
6626 always uses the faster approach.
6627
6628 .. _v6.13.1:
6629
6630 -------------------
6631 6.13.1 - 2021-05-20
6632 -------------------
6633
6634 This patch strengthens some internal import-time consistency checks for the
6635 built-in strategies.
6636
6637 There is no user-visible change.
6638
6639 .. _v6.13.0:
6640
6641 -------------------
6642 6.13.0 - 2021-05-18
6643 -------------------
6644
6645 This release adds URL fragment generation to the :func:`~hypothesis.provisional.urls`
6646 strategy (:issue:`2908`). Thanks to Pax (R. Margret) for contributing this patch at the
6647 `PyCon US Mentored Sprints <https://us.pycon.org/2021/summits/mentored-sprints/>`__!
6648
6649 .. _v6.12.1:
6650
6651 -------------------
6652 6.12.1 - 2021-05-17
6653 -------------------
6654
6655 This patch fixes :issue:`2964`, where ``.map()`` and ``.filter()`` methods
6656 were omitted from the ``repr()`` of :func:`~hypothesis.strategies.just` and
6657 :func:`~hypothesis.strategies.sampled_from` strategies, since
6658 :ref:`version 5.43.7 <v5.43.7>`.
6659
6660 .. _v6.12.0:
6661
6662 -------------------
6663 6.12.0 - 2021-05-06
6664 -------------------
6665
6666 This release automatically rewrites some simple filters, such as
6667 ``integers().filter(lambda x: x > 9)`` to the more efficient
6668 ``integers(min_value=10)``, based on the AST of the predicate.
6669
6670 We continue to recommend using the efficient form directly wherever
6671 possible, but this should be useful for e.g. :pypi:`pandera` "``Checks``"
6672 where you already have a simple predicate and translating manually
6673 is really annoying. See :issue:`2701` for ideas about floats and
6674 simple text strategies.
6675
6676 .. _v6.11.0:
6677
6678 -------------------
6679 6.11.0 - 2021-05-06
6680 -------------------
6681
6682 :func:`hypothesis.target` now returns the ``observation`` value,
6683 allowing it to be conveniently used inline in expressions such as
6684 ``assert target(abs(a - b)) < 0.1``.
6685
6686 .. _v6.10.1:
6687
6688 -------------------
6689 6.10.1 - 2021-04-26
6690 -------------------
6691
6692 This patch fixes a deprecation warning if you're using recent versions
6693 of :pypi:`importlib-metadata` (:issue:`2934`), which we use to load
6694 :ref:`third-party plugins <entry-points>` such as `Pydantic's integration
6695 <https://docs.pydantic.dev/latest/hypothesis_plugin/>`__.
6696 On older versions of :pypi:`importlib-metadata`, there is no change and
6697 you don't need to upgrade.
6698
6699 .. _v6.10.0:
6700
6701 -------------------
6702 6.10.0 - 2021-04-17
6703 -------------------
6704
6705 This release teaches the :ref:`Ghostwriter <ghostwriter>` to read parameter
6706 types from Sphinx, Google, or Numpy-style structured docstrings, and improves
6707 some related heuristics about how to test scientific and numerical programs.
6708
6709 .. _v6.9.2:
6710
6711 ------------------
6712 6.9.2 - 2021-04-15
6713 ------------------
6714
6715 This release improves the :ref:`Ghostwriter's <ghostwriter>` handling
6716 of exceptions, by reading ``:raises ...:`` entries in function docstrings
6717 and ensuring that we don't suppresss the error raised by test assertions.
6718
6719 .. _v6.9.1:
6720
6721 ------------------
6722 6.9.1 - 2021-04-12
6723 ------------------
6724
6725 This patch updates our autoformatting tools, improving our code style without any API changes.
6726
6727 .. _v6.9.0:
6728
6729 ------------------
6730 6.9.0 - 2021-04-11
6731 ------------------
6732
6733 This release teaches :func:`~hypothesis.strategies.from_type` how to see
6734 through :obj:`python:typing.Annotated`. Thanks to Vytautas Strimaitis
6735 for reporting and fixing :issue:`2919`!
6736
6737 .. _v6.8.12:
6738
6739 -------------------
6740 6.8.12 - 2021-04-11
6741 -------------------
6742
6743 If :pypi:`rich` is installed, the :command:`hypothesis write` command
6744 will use it to syntax-highlight the :ref:`Ghostwritten <ghostwriter>`
6745 code.
6746
6747 .. _v6.8.11:
6748
6749 -------------------
6750 6.8.11 - 2021-04-11
6751 -------------------
6752
6753 This patch improves an error message from :func:`~hypothesis.strategies.builds`
6754 when :func:`~hypothesis.strategies.from_type` would be more suitable (:issue:`2930`).
6755
6756 .. _v6.8.10:
6757
6758 -------------------
6759 6.8.10 - 2021-04-11
6760 -------------------
6761
6762 This patch updates the type annotations for :func:`~hypothesis.extra.numpy.arrays` to reflect that
6763 ``shape: SearchStrategy[int]`` is supported.
6764
6765 .. _v6.8.9:
6766
6767 ------------------
6768 6.8.9 - 2021-04-07
6769 ------------------
6770
6771 This patch fixes :func:`~hypothesis.strategies.from_type` with
6772 :mod:`abstract types <python:abc>` which have either required but
6773 non-type-annotated arguments to ``__init__``, or where
6774 :func:`~hypothesis.strategies.from_type` can handle some concrete
6775 subclasses but not others.
6776
6777 .. _v6.8.8:
6778
6779 ------------------
6780 6.8.8 - 2021-04-07
6781 ------------------
6782
6783 This patch teaches :command:`hypothesis write` to check for possible roundtrips
6784 in several more cases, such as by looking for an inverse in the module which
6785 defines the function to test.
6786
6787 .. _v6.8.7:
6788
6789 ------------------
6790 6.8.7 - 2021-04-07
6791 ------------------
6792
6793 This patch adds a more helpful error message if you try to call
6794 :func:`~hypothesis.strategies.sampled_from` on an :class:`~python:enum.Enum`
6795 which has no members, but *does* have :func:`~python:dataclasses.dataclass`-style
6796 annotations (:issue:`2923`).
6797
6798 .. _v6.8.6:
6799
6800 ------------------
6801 6.8.6 - 2021-04-06
6802 ------------------
6803
6804 The :func:`~hypothesis.strategies.fixed_dictionaries` strategy now preserves
6805 dict iteration order instead of sorting the keys. This also affects the
6806 pretty-printing of keyword arguments to :func:`@given() <hypothesis.given>`
6807 (:issue:`2913`).
6808
6809 .. _v6.8.5:
6810
6811 ------------------
6812 6.8.5 - 2021-04-05
6813 ------------------
6814
6815 This patch teaches :command:`hypothesis write` to default to ghostwriting
6816 tests with ``--style=pytest`` only if :pypi:`pytest` is installed, or
6817 ``--style=unittest`` otherwise.
6818
6819 .. _v6.8.4:
6820
6821 ------------------
6822 6.8.4 - 2021-04-01
6823 ------------------
6824
6825 This patch adds type annotations for the :class:`~hypothesis.settings` decorator,
6826 to avoid an error when running mypy in strict mode.
6827
6828 .. _v6.8.3:
6829
6830 ------------------
6831 6.8.3 - 2021-03-28
6832 ------------------
6833
6834 This patch improves the :ref:`Ghostwriter's <ghostwriter>` handling
6835 of strategies to generate various fiddly types including frozensets,
6836 keysviews, valuesviews, regex matches and patterns, and so on.
6837
6838 .. _v6.8.2:
6839
6840 ------------------
6841 6.8.2 - 2021-03-27
6842 ------------------
6843
6844 This patch fixes some internal typos. There is no user-visible change.
6845
6846 .. _v6.8.1:
6847
6848 ------------------
6849 6.8.1 - 2021-03-14
6850 ------------------
6851
6852 This patch lays more groundwork for filter rewriting (:issue:`2701`).
6853 There is no user-visible change... yet.
6854
6855 .. _v6.8.0:
6856
6857 ------------------
6858 6.8.0 - 2021-03-11
6859 ------------------
6860
6861 This release :func:`registers <hypothesis.strategies.register_type_strategy>` the
6862 remaining builtin types, and teaches :func:`~hypothesis.strategies.from_type` to
6863 try resolving :class:`~python:typing.ForwardRef` and :class:`~python:typing.Type`
6864 references to built-in types.
6865
6866 .. _v6.7.0:
6867
6868 ------------------
6869 6.7.0 - 2021-03-10
6870 ------------------
6871
6872 This release teaches :class:`~hypothesis.stateful.RuleBasedStateMachine` to avoid
6873 checking :func:`~hypothesis.stateful.invariant`\ s until all
6874 :func:`~hypothesis.stateful.initialize` rules have been run. You can enable checking
6875 of specific invariants for incompletely initialized machines by using
6876 ``@invariant(check_during_init=True)`` (:issue:`2868`).
6877
6878 In previous versions, it was possible if awkward to implement this behaviour
6879 using :func:`~hypothesis.stateful.precondition` and an auxiliary variable.
6880
6881 .. _v6.6.1:
6882
6883 ------------------
6884 6.6.1 - 2021-03-09
6885 ------------------
6886
6887 This patch improves the error message when :func:`~hypothesis.strategies.from_type`
6888 fails to resolve a forward-reference inside a :class:`python:typing.Type`
6889 such as ``Type["int"]`` (:issue:`2565`).
6890
6891 .. _v6.6.0:
6892
6893 ------------------
6894 6.6.0 - 2021-03-07
6895 ------------------
6896
6897 This release makes it an explicit error to apply :func:`~hypothesis.stateful.invariant`
6898 to a :func:`~hypothesis.stateful.rule` or :func:`~hypothesis.stateful.initialize` rule
6899 in :ref:`stateful testing <stateful>`. Such a combination had unclear semantics,
6900 especially in combination with :func:`~hypothesis.stateful.precondition`, and was never
6901 meant to be allowed (:issue:`2681`).
6902
6903 .. _v6.5.0:
6904
6905 ------------------
6906 6.5.0 - 2021-03-07
6907 ------------------
6908
6909 This release adds |Phase.explain|, in which Hypothesis
6910 attempts to explain *why* your test failed by pointing to suspicious lines
6911 of code (i.e. those which were always, and only, run on failing inputs).
6912 We plan to include "generalising" failing examples in this phase in a
6913 future release (:issue:`2192`).
6914
6915 .. _v6.4.3:
6916
6917 ------------------
6918 6.4.3 - 2021-03-04
6919 ------------------
6920
6921 This patch fixes :issue:`2794`, where nesting :func:`~hypothesis.strategies.deferred`
6922 strategies within :func:`~hypothesis.strategies.recursive` strategies could
6923 trigger an internal assertion. While it was always possible to get the same
6924 results from a more sensible strategy, the convoluted form now works too.
6925
6926 .. _v6.4.2:
6927
6928 ------------------
6929 6.4.2 - 2021-03-04
6930 ------------------
6931
6932 This patch fixes several problems with ``mypy`` when `--no-implicit-reexport <https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport>`_ was activated in user projects.
6933
6934 Thanks to Nikita Sobolev for fixing :issue:`2884`!
6935
6936 .. _v6.4.1:
6937
6938 ------------------
6939 6.4.1 - 2021-03-04
6940 ------------------
6941
6942 This patch fixes an exception that occurs when using type unions of
6943 the :pypi:`typing-extensions` ``Literal`` backport on Python 3.6.
6944
6945 Thanks to Ben Anhalt for identifying and fixing this bug.
6946
6947 .. _v6.4.0:
6948
6949 ------------------
6950 6.4.0 - 2021-03-02
6951 ------------------
6952
6953 This release fixes :ref:`stateful testing methods <stateful>` with multiple
6954 :func:`~hypothesis.stateful.precondition` decorators. Previously, only the
6955 outer-most precondition was checked (:issue:`2681`).
6956
6957 .. _v6.3.4:
6958
6959 ------------------
6960 6.3.4 - 2021-02-28
6961 ------------------
6962
6963 This patch refactors some internals of :class:`~hypothesis.stateful.RuleBasedStateMachine`.
6964 There is no change to the public API or behaviour.
6965
6966 .. _v6.3.3:
6967
6968 ------------------
6969 6.3.3 - 2021-02-26
6970 ------------------
6971
6972 This patch moves some internal code, so that future work can avoid
6973 creating import cycles. There is no user-visible change.
6974
6975 .. _v6.3.2:
6976
6977 ------------------
6978 6.3.2 - 2021-02-25
6979 ------------------
6980
6981 This patch enables :func:`~hypothesis.strategies.register_type_strategy` for subclasses of
6982 :obj:`python:typing.TypedDict`. Previously, :func:`~hypothesis.strategies.from_type`
6983 would ignore the registered strategy (:issue:`2872`).
6984
6985 Thanks to Ilya Lebedev for identifying and fixing this bug!
6986
6987 .. _v6.3.1:
6988
6989 ------------------
6990 6.3.1 - 2021-02-24
6991 ------------------
6992
6993 This release lays the groundwork for automatic rewriting of simple filters,
6994 for example converting ``integers().filter(lambda x: x > 9)`` to
6995 ``integers(min_value=10)``.
6996
6997 Note that this is **not supported yet**, and we will continue to recommend
6998 writing the efficient form directly wherever possible - predicate rewriting
6999 is provided mainly for the benefit of downstream libraries which would
7000 otherwise have to implement it for themselves (e.g. :pypi:`pandera` and
7001 :pypi:`icontract-hypothesis`). See :issue:`2701` for details.
7002
7003 .. _v6.3.0:
7004
7005 ------------------
7006 6.3.0 - 2021-02-20
7007 ------------------
7008
7009 The Hypothesis :pypi:`pytest` plugin now requires pytest version 4.6 or later.
7010 If the plugin detects an earlier version of pytest, it will automatically
7011 deactivate itself.
7012
7013 `(4.6.x is the earliest pytest branch that still accepts community bugfixes.)
7014 <https://docs.pytest.org/en/6.2.x/py27-py34-deprecation.html>`__
7015
7016 Hypothesis-based tests should continue to work in earlier versions of
7017 pytest, but enhanced integrations provided by the plugin
7018 (such as ``--hypothesis-show-statistics`` and other command-line flags)
7019 will no longer be available in obsolete pytest versions.
7020
7021 .. _v6.2.0:
7022
7023 ------------------
7024 6.2.0 - 2021-02-12
7025 ------------------
7026
7027 If you use :pypi:`pytest-html`, Hypothesis now includes the
7028 :ref:`summary statistics for each test <statistics>` in the HTML report,
7029 whether or not the ``--hypothesis-show-statistics`` argument was passed
7030 to show them in the command-line output.
7031
7032 .. _v6.1.1:
7033
7034 ------------------
7035 6.1.1 - 2021-01-31
7036 ------------------
7037
7038 This patch updates our automatic code formatting to use :pypi:`shed`,
7039 which includes :pypi:`autoflake`, :pypi:`black`, :pypi:`isort`, and
7040 :pypi:`pyupgrade` (:issue:`2780`).
7041
7042 .. _v6.1.0:
7043
7044 ------------------
7045 6.1.0 - 2021-01-29
7046 ------------------
7047
7048 This release teaches Hypothesis to distinguish between errors based on the
7049 `__cause__ or __context__ of otherwise identical exceptions
7050 <https://docs.python.org/3/library/exceptions.html>`__, which is particularly
7051 useful when internal errors can be wrapped by a library-specific or semantically
7052 appropriate exception such as:
7053
7054 .. code-block:: python
7055
7056 try:
7057 do_the_thing(foo, timeout=10)
7058 except Exception as err:
7059 raise FooError("Failed to do the thing") from err
7060
7061 Earlier versions of Hypothesis only see the ``FooError``, while we can now
7062 distinguish a ``FooError`` raised because of e.g. an internal assertion from
7063 one raised because of a ``TimeoutExceeded`` exception.
7064
7065 .. _v6.0.4:
7066
7067 ------------------
7068 6.0.4 - 2021-01-27
7069 ------------------
7070
7071 This release prevents a race condition inside :func:`~hypothesis.strategies.recursive` strategies.
7072 The race condition occurs when the same :func:`~hypothesis.strategies.recursive` strategy is shared among tests
7073 that are running in multiple threads (:issue:`2717`).
7074
7075 .. _v6.0.3:
7076
7077 ------------------
7078 6.0.3 - 2021-01-23
7079 ------------------
7080
7081 This patch improves the type annotations for :func:`~hypothesis.strategies.one_of`,
7082 by adding overloads to handle up to five distinct arguments as
7083 :obj:`~python:typing.Union` before falling back to :obj:`~python:typing.Any`,
7084 as well as annotating the ``|`` (``__or__``) operator for strategies (:issue:`2765`).
7085
7086 .. _v6.0.2:
7087
7088 ------------------
7089 6.0.2 - 2021-01-14
7090 ------------------
7091
7092 This release makes some small improvements to how filtered strategies work. It should improve the performance of shrinking filtered strategies,
7093 and may under some (probably rare) circumstances improve the diversity of generated examples.
7094
7095 .. _v6.0.1:
7096
7097 ------------------
7098 6.0.1 - 2021-01-13
7099 ------------------
7100
7101 This patch fixes an interaction where our :ref:`test statistics <statistics>`
7102 handling made Pytest's ``--junit-xml`` output fail to validate against the
7103 strict ``xunit2`` schema (:issue:`1975`).
7104
7105 .. _v6.0.0:
7106
7107 ------------------
7108 6.0.0 - 2021-01-08
7109 ------------------
7110
7111 Welcome to the next major version of Hypothesis!
7112
7113 There are no new features here, as we release those in minor versions.
7114 Instead, 6.0 is a chance for us to remove deprecated features (many already
7115 converted into no-ops), and turn a variety of warnings into errors.
7116
7117 If you were running on the last version of Hypothesis 5.x *without any
7118 Hypothesis deprecation warnings*, this will be a very boring upgrade.
7119 **In fact, nothing will change for you at all.**
7120
7121 Changes
7122 ~~~~~~~
7123 - Many functions now use :pep:`3102` keyword-only arguments where passing positional
7124 arguments :ref:`was deprecated since 5.5 <v5.5.0>`.
7125 - :func:`hypothesis.extra.django.from_model` no longer accepts ``model`` as a
7126 keyword argument, where it could conflict with fields named "model".
7127 - :func:`~hypothesis.strategies.randoms` now defaults to ``use_true_random=False``.
7128 - :func:`~hypothesis.strategies.complex_numbers` no longer accepts
7129 ``min_magnitude=None``; either use ``min_magnitude=0`` or just omit the argument.
7130 - ``hypothesis.provisional.ip4_addr_strings`` and ``ip6_addr_strings`` are removed
7131 in favor of :func:`ip_addresses(v=...).map(str) <hypothesis.strategies.ip_addresses>`.
7132 - :func:`~hypothesis.strategies.register_type_strategy` no longer accepts generic
7133 types with type arguments, which were always pretty badly broken.
7134 - Using function-scoped pytest fixtures is now a health-check error, instead of a warning.
7135
7136 .. tip::
7137 The :command:`hypothesis codemod` command can automatically refactor your code,
7138 particularly to convert positional to keyword arguments where those are now
7139 required.
7140
7141 Hypothesis 5.x
7142 ==============
7143
7144 .. _v5.49.0:
7145
7146 -------------------
7147 5.49.0 - 2021-01-07
7148 -------------------
7149
7150 This release adds the
7151 :obj:`~hypothesis.HealthCheck.function_scoped_fixture` health check value,
7152 which can be used to suppress the existing warning that appears when
7153 :func:`@given <hypothesis.given>` is applied to a test that uses pytest
7154 function-scoped fixtures.
7155
7156 (This warning exists because function-scoped fixtures only run once per
7157 function, not once per example, which is usually unexpected and can cause
7158 subtle problems.)
7159
7160 When this warning becomes a health check error in a future release, suppressing
7161 it via Python warning settings will no longer be possible.
7162 In the rare case that once-per-function behaviour is intended, it will still be
7163 possible to use :obj:`~hypothesis.HealthCheck.function_scoped_fixture` to
7164 opt out of the health check error for specific tests.
7165
7166 .. _v5.48.0:
7167
7168 -------------------
7169 5.48.0 - 2021-01-06
7170 -------------------
7171
7172 This release adds :func:`hypothesis.currently_in_test_context`, which can be used
7173 to check whether the calling code is currently running inside an
7174 :func:`@given <hypothesis.given>` or :ref:`stateful <stateful>` test.
7175
7176 This is most useful for third-party integrations and assertion helpers which may
7177 wish to use :func:`~hypothesis.assume` or :func:`~hypothesis.target`, without also
7178 requiring that the helper only be used from property-based tests (:issue:`2581`).
7179
7180 .. _v5.47.0:
7181
7182 -------------------
7183 5.47.0 - 2021-01-05
7184 -------------------
7185
7186 This release upgrades the import logic for :ref:`ghostwritten tests <ghostwriter>`,
7187 handling many cases where imports would previously be missing or from unexpected
7188 locations.
7189
7190 .. _v5.46.0:
7191
7192 -------------------
7193 5.46.0 - 2021-01-04
7194 -------------------
7195
7196 This release upgrades :func:`~hypothesis.strategies.from_type`, to infer
7197 strategies for type-annotated arguments even if they have defaults when
7198 it otherwise falls back to :func:`~hypothesis.strategies.builds`
7199 (:issue:`2708`).
7200
7201 .. _v5.45.0:
7202
7203 -------------------
7204 5.45.0 - 2021-01-04
7205 -------------------
7206
7207 This release adds the :ref:`codemods` extra, which you can use to
7208 check for and automatically fix issues such as use of deprecated
7209 Hypothesis APIs (:issue:`2705`).
7210
7211 .. _v5.44.0:
7212
7213 -------------------
7214 5.44.0 - 2021-01-03
7215 -------------------
7216
7217 This patch fixes :func:`~hypothesis.strategies.from_type` with
7218 the :pypi:`typing-extensions` ``Literal`` backport on Python 3.6.
7219
7220 .. _v5.43.9:
7221
7222 -------------------
7223 5.43.9 - 2021-01-02
7224 -------------------
7225
7226 This patch fixes :issue:`2722`, where certain orderings of
7227 :func:`~hypothesis.strategies.register_type_strategy`,
7228 :class:`~python:typing.ForwardRef`, and :func:`~hypothesis.strategies.from_type`
7229 could trigger an internal error.
7230
7231 .. _v5.43.8:
7232
7233 -------------------
7234 5.43.8 - 2021-01-02
7235 -------------------
7236
7237 This patch makes some strategies for collections with a uniqueness constraint
7238 much more efficient, including ``dictionaries(keys=sampled_from(...), values=..)``
7239 and ``lists(tuples(sampled_from(...), ...), unique_by=lambda x: x[0])``.
7240 (related to :issue:`2036`)
7241
7242 .. _v5.43.7:
7243
7244 -------------------
7245 5.43.7 - 2021-01-02
7246 -------------------
7247
7248 This patch extends our faster special case for
7249 :func:`~hypothesis.strategies.sampled_from` elements in unique
7250 :func:`~hypothesis.strategies.lists` to account for chains of
7251 ``.map(...)`` and ``.filter(...)`` calls (:issue:`2036`).
7252
7253 .. _v5.43.6:
7254
7255 -------------------
7256 5.43.6 - 2021-01-02
7257 -------------------
7258
7259 This patch improves the type annotations on :func:`~hypothesis.assume`
7260 and :func:`@reproduce_failure() <hypothesis.reproduce_failure>`.
7261
7262 .. _v5.43.5:
7263
7264 -------------------
7265 5.43.5 - 2021-01-01
7266 -------------------
7267
7268 This patch updates our copyright headers to include 2021. Happy new year!
7269
7270 .. _v5.43.4:
7271
7272 -------------------
7273 5.43.4 - 2020-12-24
7274 -------------------
7275
7276 This change fixes a documentation error in the
7277 :obj:`~hypothesis.settings.database` setting.
7278
7279 The previous documentation suggested that callers could specify a database
7280 path string, or the special string ``":memory:"``, but this setting has
7281 never actually allowed string arguments.
7282
7283 Permitted values are ``None``, and instances of
7284 :class:`~hypothesis.database.ExampleDatabase`.
7285
7286 .. _v5.43.3:
7287
7288 -------------------
7289 5.43.3 - 2020-12-11
7290 -------------------
7291
7292 This patch fixes :issue:`2696`, an internal error triggered when the
7293 :obj:`@example <hypothesis.example>` decorator was used and the
7294 :obj:`~hypothesis.settings.verbosity` setting was ``quiet``.
7295
7296 .. _v5.43.2:
7297
7298 -------------------
7299 5.43.2 - 2020-12-10
7300 -------------------
7301
7302 This patch improves the error message from the
7303 :func:`~hypothesis.extra.pandas.data_frames` strategy when both the ``rows``
7304 and ``columns`` arguments are given, but there is a missing entry in ``rows``
7305 and the corresponding column has no ``fill`` value (:issue:`2678`).
7306
7307 .. _v5.43.1:
7308
7309 -------------------
7310 5.43.1 - 2020-12-10
7311 -------------------
7312
7313 This patch improves the error message if :func:`~hypothesis.strategies.builds`
7314 is passed an :class:`~python:enum.Enum` which cannot be called without arguments,
7315 to suggest using :func:`~hypothesis.strategies.sampled_from` (:issue:`2693`).
7316
7317 .. _v5.43.0:
7318
7319 -------------------
7320 5.43.0 - 2020-12-09
7321 -------------------
7322
7323 This release adds new :func:`~hypothesis.strategies.timezones` and
7324 :func:`~hypothesis.strategies.timezone_keys` strategies (:issue:`2630`)
7325 based on the new :mod:`python:zoneinfo` module in Python 3.9.
7326
7327 ``pip install hypothesis[zoneinfo]`` will ensure that you have the
7328 appropriate backports installed if you need them.
7329
7330 .. _v5.42.3:
7331
7332 -------------------
7333 5.42.3 - 2020-12-09
7334 -------------------
7335
7336 This patch fixes an internal error in :func:`~hypothesis.strategies.datetimes`
7337 with ``allow_imaginary=False`` where the ``timezones`` argument can generate
7338 ``tzinfo=None`` (:issue:`2662`).
7339
7340 .. _v5.42.2:
7341
7342 -------------------
7343 5.42.2 - 2020-12-09
7344 -------------------
7345
7346 This patch teaches :func:`hypothesis.extra.django.from_field` to infer
7347 more efficient strategies by inspecting (not just filtering by) field
7348 validators for numeric and string fields (:issue:`1116`).
7349
7350 .. _v5.42.1:
7351
7352 -------------------
7353 5.42.1 - 2020-12-09
7354 -------------------
7355
7356 This patch refactors :class:`hypothesis.settings` to use type-annotated
7357 keyword arguments instead of ``**kwargs``, which makes tab-completion
7358 much more useful - as well as type-checkers like :pypi:`mypy`.
7359
7360 .. _v5.42.0:
7361
7362 -------------------
7363 5.42.0 - 2020-12-09
7364 -------------------
7365
7366 This patch teaches the :func:`~hypothesis.extra.ghostwriter.magic` ghostwriter
7367 to recognise "en/de" function roundtrips other than the common encode/decode
7368 pattern, such as encrypt/decrypt or, encipher/decipher.
7369
7370 .. _v5.41.5:
7371
7372 -------------------
7373 5.41.5 - 2020-12-05
7374 -------------------
7375
7376 This patch adds a performance optimisation to avoid saving redundant
7377 seeds when using :ref:`the .fuzz_one_input hook <fuzz_one_input>`.
7378
7379 .. _v5.41.4:
7380
7381 -------------------
7382 5.41.4 - 2020-11-28
7383 -------------------
7384
7385 This patch fixes :issue:`2657`, where passing unicode patterns compiled with
7386 :obj:`python:re.IGNORECASE` to :func:`~hypothesis.strategies.from_regex` could
7387 trigger an internal error when casefolding a character creates a longer string
7388 (e.g. ``"\u0130".lower() -> "i\u0370"``).
7389
7390 .. _v5.41.3:
7391
7392 -------------------
7393 5.41.3 - 2020-11-18
7394 -------------------
7395
7396 This patch adds a final fallback clause to :ref:`our plugin logic <entry-points>`
7397 to fail with a warning rather than error on Python < 3.8 when neither the
7398 :pypi:`importlib-metadata` (preferred) or :pypi:`setuptools` (fallback)
7399 packages are available.
7400
7401 .. _v5.41.2:
7402
7403 -------------------
7404 5.41.2 - 2020-11-08
7405 -------------------
7406
7407 This patch fixes :func:`~hypothesis.provisional.urls` strategy ensuring that
7408 ``~`` (tilde) is treated as one of the url-safe characters (:issue:`2658`).
7409
7410 .. _v5.41.1:
7411
7412 -------------------
7413 5.41.1 - 2020-11-03
7414 -------------------
7415
7416 This patch improves our :ref:`CLI help and documentation <hypothesis-cli>`.
7417
7418 .. _v5.41.0:
7419
7420 -------------------
7421 5.41.0 - 2020-10-30
7422 -------------------
7423
7424 Hypothesis now shrinks examples where the error is raised while drawing from
7425 a strategy. This makes complicated custom strategies *much* easier to debug,
7426 at the cost of a slowdown for use-cases where you catch and ignore such errors.
7427
7428 .. _v5.40.0:
7429
7430 -------------------
7431 5.40.0 - 2020-10-30
7432 -------------------
7433
7434 This release teaches :func:`~hypothesis.strategies.from_type` how to handle
7435 :class:`~python:typing.ChainMap`, :class:`~python:typing.Counter`,
7436 :class:`~python:typing.Deque`, :class:`~python:typing.Generator`,
7437 :class:`~python:typing.Match`, :class:`~python:typing.OrderedDict`,
7438 :class:`~python:typing.Pattern`, and :class:`~python:collections.abc.Set`
7439 (:issue:`2654`).
7440
7441 .. _v5.39.0:
7442
7443 -------------------
7444 5.39.0 - 2020-10-30
7445 -------------------
7446
7447 :func:`~hypothesis.strategies.from_type` now knows how to resolve :pep:`585`
7448 parameterized standard collection types, which are new in Python 3.9
7449 (:issue:`2629`).
7450
7451 .. _v5.38.1:
7452
7453 -------------------
7454 5.38.1 - 2020-10-26
7455 -------------------
7456
7457 This patch fixes :func:`~hypothesis.strategies.builds`, so that when passed
7458 :obj:`~hypothesis.infer` for an argument with a non-:obj:`~python:typing.Optional`
7459 type annotation and a default value of ``None`` to build a class which defines
7460 an explicit ``__signature__`` attribute, either ``None`` or that type may be
7461 generated.
7462
7463 This is unlikely to happen unless you are using :pypi:`pydantic` (:issue:`2648`).
7464
7465 .. _v5.38.0:
7466
7467 -------------------
7468 5.38.0 - 2020-10-24
7469 -------------------
7470
7471 This release improves our support for :func:`@st.composite <hypothesis.strategies.composite>`
7472 on a :obj:`python:classmethod` or :obj:`python:staticmethod` (:issue:`2578`).
7473
7474 .. _v5.37.5:
7475
7476 -------------------
7477 5.37.5 - 2020-10-24
7478 -------------------
7479
7480 This patch fixes :func:`~hypothesis.strategies.from_type` with
7481 :class:`Iterable[T] <python:typing.Iterable>` (:issue:`2645`).
7482
7483 .. _v5.37.4:
7484
7485 -------------------
7486 5.37.4 - 2020-10-20
7487 -------------------
7488
7489 This patch teaches the :func:`~hypothesis.extra.ghostwriter.magic` ghostwriter
7490 to recognise that pairs of functions like :func:`~python:colorsys.rgb_to_hsv`
7491 and :func:`~python:colorsys.hsv_to_rgb` should
7492 :func:`~hypothesis.extra.ghostwriter.roundtrip`.
7493
7494 .. _v5.37.3:
7495
7496 -------------------
7497 5.37.3 - 2020-10-15
7498 -------------------
7499
7500 This patch improves :func:`~hypothesis.strategies.builds` and
7501 :func:`~hypothesis.strategies.from_type` support for explicitly defined ``__signature__``
7502 attributes, from :ref:`version 5.8.3 <v5.8.3>`, to support generic types from the
7503 :mod:`python:typing` module.
7504
7505 Thanks to Rónán Carrigan for identifying and fixing this problem!
7506
7507 .. _v5.37.2:
7508
7509 -------------------
7510 5.37.2 - 2020-10-14
7511 -------------------
7512
7513 This patch fixes :func:`~hypothesis.extra.lark.from_lark` with version
7514 0.10.1+ of the :pypi:`lark-parser` package.
7515
7516 .. _v5.37.1:
7517
7518 -------------------
7519 5.37.1 - 2020-10-07
7520 -------------------
7521
7522 This patch fixes some broken links in the :mod:`~hypothesis.extra.lark`
7523 extra documentation.
7524
7525 .. _v5.37.0:
7526
7527 -------------------
7528 5.37.0 - 2020-10-03
7529 -------------------
7530
7531 This release adds a new :class:`~hypothesis.extra.redis.RedisExampleDatabase`,
7532 along with the :class:`~hypothesis.database.ReadOnlyDatabase`
7533 and :class:`~hypothesis.database.MultiplexedDatabase` helpers, to support
7534 team workflows where failing examples can be seamlessly shared between everyone
7535 on the team - and your CI servers or buildbots.
7536
7537 .. _v5.36.2:
7538
7539 -------------------
7540 5.36.2 - 2020-10-02
7541 -------------------
7542
7543 This patch ensures that if the :ref:`"hypothesis" entry point <entry-points>`
7544 is callable, we call it after importing it. You can still use non-callable
7545 entry points (like modules), which are only imported.
7546
7547 We also prefer `importlib.metadata <https://docs.python.org/3/library/importlib.metadata.html>`__
7548 or :pypi:`the backport <importlib-metadata>` over `pkg_resources
7549 <https://setuptools.pypa.io/en/latest/pkg_resources.html>`__,
7550 which makes ``import hypothesis`` around 200 milliseconds faster
7551 (:issue:`2571`).
7552
7553 .. _v5.36.1:
7554
7555 -------------------
7556 5.36.1 - 2020-09-25
7557 -------------------
7558
7559 This patch adds some helpful suggestions to error messages you might see
7560 while learning to use the :obj:`@example() <hypothesis.example>` decorator
7561 (:issue:`2611`) or the :func:`~hypothesis.strategies.one_of` strategy.
7562
7563 .. _v5.36.0:
7564
7565 -------------------
7566 5.36.0 - 2020-09-24
7567 -------------------
7568
7569 This release upgrades the :func:`~hypothesis.extra.numpy.from_dtype` strategy
7570 to pass optional ``**kwargs`` to the inferred strategy, and upgrades the
7571 :func:`~hypothesis.extra.numpy.arrays` strategy to accept an ``elements=kwargs``
7572 dict to pass through to :func:`~hypothesis.extra.numpy.from_dtype`.
7573
7574 ``arrays(floating_dtypes(), shape, elements={"min_value": -10, "max_value": 10})``
7575 is a particularly useful pattern, as it allows for any floating dtype without
7576 triggering the roundoff warning for smaller types or sacrificing variety for
7577 larger types (:issue:`2552`).
7578
7579 .. _v5.35.4:
7580
7581 -------------------
7582 5.35.4 - 2020-09-21
7583 -------------------
7584
7585 This patch reformats our code with the latest :pypi:`black` to
7586 take advantage of the support for magic trailing commas.
7587
7588 .. _v5.35.3:
7589
7590 -------------------
7591 5.35.3 - 2020-09-15
7592 -------------------
7593
7594 This release significantly improves the performance of Hypothesis's internal
7595 implementation of automaton learning. However this code does not run as part
7596 of the user-accessible API so this has no user-visible impact.
7597
7598 .. _v5.35.2:
7599
7600 -------------------
7601 5.35.2 - 2020-09-14
7602 -------------------
7603
7604 This patch ensures that, when the ``generate`` :obj:`~hypothesis.settings.phases`
7605 is disabled, we can replay up to :obj:`~hypothesis.settings.max_examples` examples
7606 from the database - which is very useful when
7607 :ref:`using Hypothesis with a fuzzer <fuzz_one_input>`.
7608
7609 Thanks to Afrida Tabassum for fixing :issue:`2585`!
7610
7611 .. _v5.35.1:
7612
7613 -------------------
7614 5.35.1 - 2020-09-14
7615 -------------------
7616
7617 This patch changes some internal :obj:`python:struct.Struct.format` strings
7618 from ``bytes`` to ``str``, to avoid :class:`python:BytesWarning` when running
7619 `python -bb <https://docs.python.org/3/using/cmdline.html#cmdoption-b>`__.
7620
7621 Thanks to everyone involved in `pytest-xdist issue 596
7622 <https://github.com/pytest-dev/pytest-xdist/issues/596>`__,
7623 :bpo:`16349`, :bpo:`21071`, and :bpo:`41777` for their work on this -
7624 it was a remarkably subtle issue!
7625
7626 .. _v5.35.0:
7627
7628 -------------------
7629 5.35.0 - 2020-09-11
7630 -------------------
7631
7632 The :func:`~hypothesis.target` function now accepts integers as well as floats.
7633
7634 .. _v5.34.1:
7635
7636 -------------------
7637 5.34.1 - 2020-09-11
7638 -------------------
7639
7640 This patch adds explicit :obj:`~python:typing.Optional` annotations to our public API,
7641 to better support users who run :pypi:`mypy` with ``--strict`` or ``no_implicit_optional=True``.
7642
7643 Thanks to Krzysztof Przybyła for bringing this to our attention and writing the patch!
7644
7645 .. _v5.34.0:
7646
7647 -------------------
7648 5.34.0 - 2020-09-11
7649 -------------------
7650
7651 This release drops support for Python 3.5, which `reached end of life upstream
7652 <https://devguide.python.org/#status-of-python-branches>`__ on 2020-09-13.
7653
7654 .. _v5.33.2:
7655
7656 -------------------
7657 5.33.2 - 2020-09-09
7658 -------------------
7659
7660 This patch fixes a problem with :func:`~hypothesis.strategies.builds` that was not able to
7661 generate valid data for annotated classes with constructors.
7662
7663 Thanks to Nikita Sobolev for fixing :issue:`2603`!
7664
7665 .. _v5.33.1:
7666
7667 -------------------
7668 5.33.1 - 2020-09-07
7669 -------------------
7670
7671 This patch improves the error message from the :command:`hypothesis write`
7672 command if :pypi:`black` (required for the :ref:`ghostwriter <ghostwriter>`)
7673 is not installed.
7674
7675 Thanks to Nikita Sobolev for fixing :issue:`2604`!
7676
7677 .. _v5.33.0:
7678
7679 -------------------
7680 5.33.0 - 2020-09-06
7681 -------------------
7682
7683 When reporting failing examples, or tried examples in verbose mode, Hypothesis now
7684 identifies which were from :obj:`@example(...) <hypothesis.example>` explicit examples.
7685
7686 .. _v5.32.1:
7687
7688 -------------------
7689 5.32.1 - 2020-09-06
7690 -------------------
7691
7692 This patch contains some internal refactoring.
7693 Thanks to Felix Sheldon for fixing :issue:`2516`!
7694
7695 .. _v5.32.0:
7696
7697 -------------------
7698 5.32.0 - 2020-09-04
7699 -------------------
7700
7701 An array drawn from :func:`~hypothesis.extra.numpy.arrays` will own its own memory; previously most arrays returned by
7702 this strategy were views.
7703
7704 .. _v5.31.0:
7705
7706 -------------------
7707 5.31.0 - 2020-09-04
7708 -------------------
7709
7710 :func:`~hypothesis.strategies.builds` will use the ``__signature__`` attribute of
7711 the target, if it exists, to retrieve type hints.
7712 Previously :func:`python:typing.get_type_hints`, was used by default.
7713 If argument names varied between the ``__annotations__`` and ``__signature__``,
7714 they would not be supplied to the target.
7715
7716 This was particularly an issue for :pypi:`pydantic` models which use an
7717 `alias generator <https://docs.pydantic.dev/latest/api/config/#pydantic.alias_generators>`__.
7718
7719 .. _v5.30.1:
7720
7721 -------------------
7722 5.30.1 - 2020-09-04
7723 -------------------
7724
7725 This patch makes the :ref:`ghostwriter <ghostwriter>` much more robust when
7726 passed unusual modules.
7727
7728 - improved support for non-resolvable type annotations
7729 - :func:`~hypothesis.extra.ghostwriter.magic` can now write
7730 :func:`~hypothesis.extra.ghostwriter.equivalent` tests
7731 - running :func:`~hypothesis.extra.ghostwriter.magic` on modules where some
7732 names in ``__all__`` are undefined skips such names, instead of raising an error
7733 - :func:`~hypothesis.extra.ghostwriter.magic` now knows to skip mocks
7734 - improved handling of import-time errors found by the ghostwriter CLI
7735
7736 .. _v5.30.0:
7737
7738 -------------------
7739 5.30.0 - 2020-08-30
7740 -------------------
7741
7742 :func:`~hypothesis.strategies.register_type_strategy` now supports
7743 :class:`python:typing.TypeVar`, which was previously hard-coded, and allows a
7744 variety of types to be generated for an unconstrained :class:`~python:typing.TypeVar`
7745 instead of just :func:`~hypothesis.strategies.text`.
7746
7747 Thanks again to Nikita Sobolev for all your work on advanced types!
7748
7749 .. _v5.29.4:
7750
7751 -------------------
7752 5.29.4 - 2020-08-28
7753 -------------------
7754
7755 This release fixes some hard to trigger bugs in Hypothesis's automata learning
7756 code. This code is only run as part of the Hypothesis build process, and not
7757 for user code, so this release has no user visible impact.
7758
7759 .. _v5.29.3:
7760
7761 -------------------
7762 5.29.3 - 2020-08-27
7763 -------------------
7764
7765 This patch adds type annotations to the :ref:`hypothesis.database <database>`
7766 module. There is no runtime change, but your typechecker might notice.
7767
7768 .. _v5.29.2:
7769
7770 -------------------
7771 5.29.2 - 2020-08-27
7772 -------------------
7773
7774 This patch tracks some additional information in Hypothesis internals,
7775 and has no user-visible impact.
7776
7777 .. _v5.29.1:
7778
7779 -------------------
7780 5.29.1 - 2020-08-27
7781 -------------------
7782
7783 This release fixes a bug in some Hypothesis internal support code for learning
7784 automata. This mostly doesn't have any user visible impact, although it slightly
7785 affects the learned shrink passes so shrinking may be subtly different.
7786
7787 .. _v5.29.0:
7788
7789 -------------------
7790 5.29.0 - 2020-08-24
7791 -------------------
7792
7793 This release adds support for :ref:`entry-points`, which allows for smoother
7794 integration of third-party Hypothesis extensions and external libraries.
7795 Unless you're publishing a library with Hypothesis integration, you'll
7796 probably only ever use this indirectly!
7797
7798 .. _v5.28.0:
7799
7800 -------------------
7801 5.28.0 - 2020-08-24
7802 -------------------
7803
7804 :func:`~hypothesis.strategies.from_type` can now resolve :class:`~python:typing.TypeVar`
7805 instances when the ``bound`` is a :class:`~python:typing.ForwardRef`, so long as that name
7806 is in fact defined in the same module as the typevar (no ``TYPE_CHECKING`` tricks, sorry).
7807 This feature requires Python 3.7 or later.
7808
7809 Thanks to Zac Hatfield-Dodds and Nikita Sobolev for this feature!
7810
7811 .. _v5.27.0:
7812
7813 -------------------
7814 5.27.0 - 2020-08-20
7815 -------------------
7816
7817 This patch adds two new :ref:`ghostwriters <ghostwriter>` to test
7818 :wikipedia:`binary operations <Binary_operation>`, like :func:`python:operator.add`,
7819 and Numpy :doc:`ufuncs <numpy:reference/ufuncs>` and :doc:`gufuncs
7820 <numpy:reference/c-api/generalized-ufuncs>` like :data:`np.matmul() <numpy:numpy.matmul>`.
7821
7822 .. _v5.26.1:
7823
7824 -------------------
7825 5.26.1 - 2020-08-19
7826 -------------------
7827
7828 This release improves the performance of some methods in Hypothesis's internal
7829 automaton library. These are currently only lightly used by user code, but
7830 this may result in slightly faster shrinking.
7831
7832 .. _v5.26.0:
7833
7834 -------------------
7835 5.26.0 - 2020-08-17
7836 -------------------
7837
7838 :func:`~hypothesis.strategies.register_type_strategy` no longer accepts
7839 parametrised user-defined generic types, because the resolution logic
7840 was quite badly broken (:issue:`2537`).
7841
7842 Instead of registering a strategy for e.g. ``MyCollection[int]``, you
7843 should register a *function* for ``MyCollection`` and `inspect the type
7844 parameters within that function <https://stackoverflow.com/q/48572831>`__.
7845
7846 Thanks to Nikita Sobolev for the bug report, design assistance, and
7847 pull request to implement this feature!
7848
7849 .. _v5.25.0:
7850
7851 -------------------
7852 5.25.0 - 2020-08-16
7853 -------------------
7854
7855 Tired of writing tests? Or new to Hypothesis and not sure where to start?
7856
7857 This release is for you! With our new :ref:`Ghostwriter functions <ghostwriter>`
7858 and :command:`hypothesis write ...` :ref:`command-line interface <hypothesis-cli>`,
7859 you can stop writing tests entirely... or take the source code Hypothesis
7860 writes for you as a starting point.
7861
7862 This has been in the works for months, from :issue:`2118` to versions
7863 :ref:`5.18.3 <v5.18.3>`, :ref:`5.23.5 <v5.23.5>`, and :ref:`5.23.5 <v5.23.5>` -
7864 particular thanks to the many people who reviewed pull requests or commented on
7865 demos, and to Timothy Crosley's :pypi:`hypothesis-auto` project for inspiration.
7866
7867 .. _v5.24.4:
7868
7869 -------------------
7870 5.24.4 - 2020-08-14
7871 -------------------
7872
7873 This patch adds yet more internal functions to support a new feature
7874 we're working on, like :ref:`version 5.18.3 <v5.18.3>` and
7875 :ref:`version 5.23.6 <v5.23.6>`. We promise it's worth the wait!
7876
7877 .. _v5.24.3:
7878
7879 -------------------
7880 5.24.3 - 2020-08-13
7881 -------------------
7882
7883 This release fixes a small internal bug in Hypothesis's internal automaton library.
7884 Fortunately this bug was currently impossible to hit in user facing code, so this
7885 has no user visible impact.
7886
7887 .. _v5.24.2:
7888
7889 -------------------
7890 5.24.2 - 2020-08-12
7891 -------------------
7892
7893 This release improves shrink quality by allowing Hypothesis to automatically learn new shrink passes
7894 for difficult to shrink tests.
7895
7896 The automatic learning is not currently accessible in user code (it still needs significant work
7897 on robustness and performance before it is ready for that), but this release includes learned
7898 passes that should improve shrinking quality for tests which use any of the
7899 :func:`~hypothesis.strategies.text`, :func:`~hypothesis.strategies.floats`,
7900 :func:`~hypothesis.strategies.datetimes`, :func:`~hypothesis.strategies.emails`,
7901 and :func:`~hypothesis.strategies.complex_numbers` strategies.
7902
7903 .. _v5.24.1:
7904
7905 -------------------
7906 5.24.1 - 2020-08-12
7907 -------------------
7908
7909 This patch updates some docstrings, without changing runtime behaviour.
7910
7911 .. _v5.24.0:
7912
7913 -------------------
7914 5.24.0 - 2020-08-10
7915 -------------------
7916
7917 The :func:`~hypothesis.strategies.functions` strategy has a new argument
7918 ``pure=True``, which ensures that the same return value is generated for
7919 identical calls to the generated function (:issue:`2538`).
7920
7921 Thanks to Zac Hatfield-Dodds and Nikita Sobolev for this feature!
7922
7923 .. _v5.23.12:
7924
7925 --------------------
7926 5.23.12 - 2020-08-10
7927 --------------------
7928
7929 This release removes a number of Hypothesis's internal "shrink passes" - transformations
7930 it makes to a generated test case during shrinking - which appeared to be redundant with
7931 other transformations.
7932
7933 It is unlikely that you will see much impact from this. If you do, it will likely show up
7934 as a change in shrinking performance (probably slower, maybe faster), or possibly in
7935 worse shrunk results. If you encounter the latter, please let us know.
7936
7937 .. _v5.23.11:
7938
7939 --------------------
7940 5.23.11 - 2020-08-04
7941 --------------------
7942
7943 This release fixes a bug in some internal Hypothesis support code. It has no user visible impact.
7944
7945 .. _v5.23.10:
7946
7947 --------------------
7948 5.23.10 - 2020-08-04
7949 --------------------
7950
7951 This release improves the quality of shrunk test cases in some special cases.
7952 Specifically, it should get shrinking unstuck in some scenarios which require
7953 simultaneously changing two parts of the generated test case.
7954
7955 .. _v5.23.9:
7956
7957 -------------------
7958 5.23.9 - 2020-08-03
7959 -------------------
7960
7961 This release improves the performance of some internal support code. It has no user visible impact,
7962 as that code is not currently run during normal Hypothesis operation.
7963
7964 .. _v5.23.8:
7965
7966 -------------------
7967 5.23.8 - 2020-07-31
7968 -------------------
7969
7970 This release adds a heuristic to detect when shrinking has finished despite the fact
7971 that there are many more possible transformations to try. This will be particularly
7972 useful for tests where the minimum failing test case is very large despite there being
7973 many smaller test cases possible, where it is likely to speed up shrinking dramatically.
7974
7975 In some cases it is likely that this will result in worse shrunk test cases. In those
7976 cases rerunning the test will result in further shrinking.
7977
7978 .. _v5.23.7:
7979
7980 -------------------
7981 5.23.7 - 2020-07-29
7982 -------------------
7983
7984 This release makes some performance improvements to shrinking. They should
7985 only be noticeable for tests that are currently particularly slow to shrink.
7986
7987 .. _v5.23.6:
7988
7989 -------------------
7990 5.23.6 - 2020-07-29
7991 -------------------
7992
7993 This patch adds some more internal functions to support a new
7994 feature we're working on, like :ref:`version 5.18.3 <v5.18.3>`.
7995 There is still no user-visible change... yet.
7996
7997 .. _v5.23.5:
7998
7999 -------------------
8000 5.23.5 - 2020-07-29
8001 -------------------
8002
8003 This release makes some changes to internal support code that is not currently used in production Hypothesis.
8004 It has no user visible effect at present.
8005
8006 .. _v5.23.4:
8007
8008 -------------------
8009 5.23.4 - 2020-07-29
8010 -------------------
8011
8012 This release improves shrinking quality in some special cases.
8013
8014 .. _v5.23.3:
8015
8016 -------------------
8017 5.23.3 - 2020-07-27
8018 -------------------
8019
8020 This release fixes :issue:`2507`, where lazy evaluation meant that the
8021 values drawn from a :func:`~hypothesis.strategies.sampled_from` strategy
8022 could depend on mutations of the sampled sequence that happened after
8023 the strategy was constructed.
8024
8025 .. _v5.23.2:
8026
8027 -------------------
8028 5.23.2 - 2020-07-27
8029 -------------------
8030
8031 This patch fixes :issue:`2462`, a bug in our handling of :meth:`unittest.TestCase.subTest`.
8032 Thanks to Israel Fruchter for fixing this at the EuroPython sprints!
8033
8034 .. _v5.23.1:
8035
8036 -------------------
8037 5.23.1 - 2020-07-26
8038 -------------------
8039
8040 This release improves the behaviour of the :func:`~hypothesis.strategies.characters` strategy
8041 when shrinking, by changing which characters are considered smallest to prefer more "normal" ascii characters
8042 where available.
8043
8044 .. _v5.23.0:
8045
8046 -------------------
8047 5.23.0 - 2020-07-26
8048 -------------------
8049
8050 The default ``print_blob`` setting is now smarter. It defaults to ``True`` in CI and
8051 ``False`` for local development.
8052
8053 Thanks to Hugo van Kemenade for implementing this feature at the EuroPython sprints!
8054
8055 .. _v5.22.0:
8056
8057 -------------------
8058 5.22.0 - 2020-07-25
8059 -------------------
8060
8061 The :func:`~hypothesis.strategies.slices` strategy can now generate slices for empty sequences,
8062 slices with negative start and stop indices (from the end of the sequence),
8063 and ``step=None`` in place of ``step=1``.
8064
8065 Thanks to Sangarshanan for implementing this feature at the EuroPython sprints!
8066
8067 .. _v5.21.0:
8068
8069 -------------------
8070 5.21.0 - 2020-07-23
8071 -------------------
8072
8073 This release ensures that tests which raise ``RecursionError`` are not
8074 reported as flaky simply because we run them from different initial
8075 stack depths (:issue:`2494`).
8076
8077 .. _v5.20.4:
8078
8079 -------------------
8080 5.20.4 - 2020-07-23
8081 -------------------
8082
8083 This release improves the performance of the ``sample`` method on objects obtained from :func:`~hypothesis.strategies.randoms`
8084 when ``use_true_random=False``. This should mostly only be noticeable when the sample size is a large fraction of the population size,
8085 but may also help avoid health check failures in some other cases.
8086
8087 .. _v5.20.3:
8088
8089 -------------------
8090 5.20.3 - 2020-07-21
8091 -------------------
8092
8093 This release makes some internal changes for testing purposes and should have no user visible effect.
8094
8095 .. _v5.20.2:
8096
8097 -------------------
8098 5.20.2 - 2020-07-18
8099 -------------------
8100
8101 This release fixes a small caching bug in Hypothesis internals that may under
8102 some circumstances have resulted in a less diverse set of test cases being
8103 generated than was intended.
8104
8105 Fixing this problem revealed some performance problems that could occur during targeted property based testing, so this release also fixes those. Targeted property-based testing should now be significantly faster in some cases,
8106 but this may be at the cost of reduced effectiveness.
8107
8108 .. _v5.20.1:
8109
8110 -------------------
8111 5.20.1 - 2020-07-17
8112 -------------------
8113
8114 This patch updates our formatting to use :pypi:`isort` 5.
8115 There is no user-visible change.
8116
8117 .. _v5.20.0:
8118
8119 -------------------
8120 5.20.0 - 2020-07-17
8121 -------------------
8122
8123 The :func:`~hypothesis.extra.numpy.basic_indices` strategy can now generate
8124 bare indexers in place of length-one tuples. Thanks to Andrea for this patch!
8125
8126 .. _v5.19.3:
8127
8128 -------------------
8129 5.19.3 - 2020-07-15
8130 -------------------
8131
8132 This patch removes an internal use of ``distutils`` in order to avoid
8133 `this setuptools warning <https://github.com/pypa/setuptools/issues/2261>`__
8134 for some users.
8135
8136 .. _v5.19.2:
8137
8138 -------------------
8139 5.19.2 - 2020-07-13
8140 -------------------
8141
8142 This patch contains a small internal refactoring with no user-visible impact.
8143
8144 Thanks to Andrea for writing this at
8145 `the SciPy 2020 Sprints <https://www.scipy2020.scipy.org/sprints-schedule>`__!
8146
8147 .. _v5.19.1:
8148
8149 -------------------
8150 5.19.1 - 2020-07-12
8151 -------------------
8152
8153 This release slightly improves shrinking behaviour. This should mainly only
8154 impact stateful tests, but may have some minor positive impact on shrinking
8155 collections (lists, sets, etc).
8156
8157 .. _v5.19.0:
8158
8159 -------------------
8160 5.19.0 - 2020-06-30
8161 -------------------
8162
8163 This release improves the :func:`~hypothesis.strategies.randoms` strategy by adding support
8164 for ``Random`` instances where Hypothesis generates the random values
8165 rather than having them be "truly" random.
8166
8167 .. _v5.18.3:
8168
8169 -------------------
8170 5.18.3 - 2020-06-27
8171 -------------------
8172
8173 This patch adds some internal functions to support a new feature
8174 we're working on. There is no user-visible change... yet.
8175
8176 .. _v5.18.2:
8177
8178 -------------------
8179 5.18.2 - 2020-06-26
8180 -------------------
8181
8182 This patch improves our docs for the :obj:`~hypothesis.settings.derandomize` setting.
8183
8184 .. _v5.18.1:
8185
8186 -------------------
8187 5.18.1 - 2020-06-25
8188 -------------------
8189
8190 This release consists of some internal refactoring to the shrinker in preparation for future work. It has no user visible impact.
8191
8192 .. _v5.18.0:
8193
8194 -------------------
8195 5.18.0 - 2020-06-22
8196 -------------------
8197
8198 This release teaches Hypothesis to :ref:`shorten tracebacks <v3.79.2>` for |@example|, as we already do
8199 for generated examples, so that you can focus on your code rather than ours.
8200
8201 If you have multiple failing explicit examples, they will now all be reported.
8202 To report only the first failure, you can use the :obj:`report_multiple_bugs=False
8203 <hypothesis.settings.report_multiple_bugs>` setting as for generated examples.
8204
8205 .. _v5.17.0:
8206
8207 -------------------
8208 5.17.0 - 2020-06-22
8209 -------------------
8210
8211 This patch adds strategy inference for the ``Literal``, ``NewType``, ``Type``,
8212 ``DefaultDict``, and ``TypedDict`` types from the :pypi:`typing-extensions`
8213 backport on PyPI.
8214
8215 .. _v5.16.3:
8216
8217 -------------------
8218 5.16.3 - 2020-06-21
8219 -------------------
8220
8221 This patch precomputes some of the setup logic for our
8222 :ref:`external fuzzer integration <fuzz_one_input>` and sets
8223 :obj:`deadline=None <hypothesis.settings.deadline>` in fuzzing mode,
8224 saving around 150us on each iteration.
8225
8226 This is around two-thirds the runtime to fuzz an empty test with
8227 ``@given(st.none())``, and nice to have even as a much smaller
8228 fraction of the runtime for non-trivial tests.
8229
8230 .. _v5.16.2:
8231
8232 -------------------
8233 5.16.2 - 2020-06-19
8234 -------------------
8235
8236 This patch fixes an internal error when warning about the use of function-scoped fixtures
8237 for parametrised tests where the parametrised value contained a ``%`` character.
8238 Thanks to Bryant for reporting and fixing this bug!
8239
8240 .. _v5.16.1:
8241
8242 -------------------
8243 5.16.1 - 2020-06-10
8244 -------------------
8245
8246 If you pass a :class:`python:list` or :class:`python:tuple` where a
8247 strategy was expected, the error message now mentions
8248 :func:`~hypothesis.strategies.sampled_from` as an example strategy.
8249
8250 Thanks to the enthusiastic participants in the `PyCon Mentored Sprints
8251 <https://us.pycon.org/2020/hatchery/mentoredsprints/>`__ who suggested
8252 adding this hint.
8253
8254 .. _v5.16.0:
8255
8256 -------------------
8257 5.16.0 - 2020-05-27
8258 -------------------
8259
8260 :func:`~hypothesis.strategies.functions` can now infer the appropriate ``returns``
8261 strategy if you pass a ``like`` function with a return-type annotation. Before,
8262 omitting the ``returns`` argument would generate functions that always returned None.
8263
8264 .. _v5.15.1:
8265
8266 -------------------
8267 5.15.1 - 2020-05-21
8268 -------------------
8269
8270 Fix :func:`~hypothesis.strategies.from_type` with generic types under Python 3.9.
8271
8272 .. _v5.15.0:
8273
8274 -------------------
8275 5.15.0 - 2020-05-19
8276 -------------------
8277
8278 This patch fixes an error that happens when multiple threads create new strategies.
8279
8280 .. _v5.14.0:
8281
8282 -------------------
8283 5.14.0 - 2020-05-13
8284 -------------------
8285
8286 Passing ``min_magnitude=None`` to :func:`~hypothesis.strategies.complex_numbers` is now
8287 deprecated - you can explicitly pass ``min_magnitude=0``, or omit the argument entirely.
8288
8289 .. _v5.13.1:
8290
8291 -------------------
8292 5.13.1 - 2020-05-13
8293 -------------------
8294
8295 This patch fixes an internal error in :func:`~hypothesis.strategies.from_type`
8296 for :obj:`python:typing.NamedTuple` in Python 3.9. Thanks to Michel Salim
8297 for reporting and fixing :issue:`2427`!
8298
8299 .. _v5.13.0:
8300
8301 -------------------
8302 5.13.0 - 2020-05-12
8303 -------------------
8304
8305 This release upgrades the test statistics available via the
8306 :ref:`--hypothesis-show-statistics <statistics>` option to include
8307 separate information on each of the :attr:`~hypothesis.settings.phases`
8308 (:issue:`1555`).
8309
8310 .. _v5.12.2:
8311
8312 -------------------
8313 5.12.2 - 2020-05-12
8314 -------------------
8315
8316 This patch teaches the :func:`~hypothesis.strategies.from_type` internals to
8317 return slightly more efficient strategies for some generic sets and mappings.
8318
8319 .. _v5.12.1:
8320
8321 -------------------
8322 5.12.1 - 2020-05-12
8323 -------------------
8324
8325 This patch adds a ``# noqa`` comment for :pypi:`flake8` 3.8.0, which
8326 disagrees with :pypi:`mypy` about how to write the type of ``...``.
8327
8328 .. _v5.12.0:
8329
8330 -------------------
8331 5.12.0 - 2020-05-10
8332 -------------------
8333
8334 This release limits the maximum duration of the shrinking phase to five minutes,
8335 so that Hypothesis does not appear to hang when making very slow progress
8336 shrinking a failing example (:issue:`2340`).
8337
8338 If one of your tests triggers this logic, we would really appreciate a bug
8339 report to help us improve the shrinker for difficult but realistic workloads.
8340
8341 .. _v5.11.0:
8342
8343 -------------------
8344 5.11.0 - 2020-05-07
8345 -------------------
8346
8347 This release improves the interaction between :func:`~hypothesis.assume`
8348 and the :obj:`@example() <hypothesis.example>` decorator, so that the
8349 following test no longer fails with ``UnsatisfiedAssumption`` (:issue:`2125`):
8350
8351 .. code-block:: python
8352
8353 @given(value=floats(0, 1))
8354 @example(value=0.56789) # used to make the test fail!
8355 @pytest.mark.parametrize("threshold", [0.5, 1])
8356 def test_foo(threshold, value):
8357 assume(value < threshold)
8358 ...
8359
8360 .. _v5.10.5:
8361
8362 -------------------
8363 5.10.5 - 2020-05-04
8364 -------------------
8365
8366 If you have :pypi:`Django` installed but don't use it, this patch will make
8367 ``import hypothesis`` a few hundred milliseconds faster (e.g. 0.704s -> 0.271s).
8368
8369 Thanks to :pypi:`importtime-waterfall` for highlighting this problem and
8370 `Jake Vanderplas <https://twitter.com/jakevdp/status/1130983439862181888>`__ for
8371 the solution - it's impossible to misuse code from a module you haven't imported!
8372
8373 .. _v5.10.4:
8374
8375 -------------------
8376 5.10.4 - 2020-04-24
8377 -------------------
8378
8379 This patch improves the internals of :func:`~hypothesis.strategies.builds` type
8380 inference, to handle recursive forward references in certain dataclasses.
8381 This is useful for e.g. :pypi:`hypothesmith`'s forthcoming :pypi:`LibCST <libcst>` mode.
8382
8383 .. _v5.10.3:
8384
8385 -------------------
8386 5.10.3 - 2020-04-22
8387 -------------------
8388
8389 This release reverses the order in which some operations are tried during shrinking.
8390 This should generally be a slight performance improvement, but most tests are unlikely to notice much difference.
8391
8392 .. _v5.10.2:
8393
8394 -------------------
8395 5.10.2 - 2020-04-22
8396 -------------------
8397
8398 This patch fixes :issue:`2406`, where use of :obj:`pandas:pandas.Timestamp`
8399 objects as bounds for the :func:`~hypothesis.strategies.datetimes` strategy
8400 caused an internal error. This bug was introduced in :ref:`version 5.8.1 <v5.8.2>`.
8401
8402 .. _v5.10.1:
8403
8404 -------------------
8405 5.10.1 - 2020-04-19
8406 -------------------
8407
8408 This release is a small internal refactoring to how shrinking interacts with :ref:`targeted property-based testing <targeted>` that should have no user visible impact.
8409
8410 .. _v5.10.0:
8411
8412 -------------------
8413 5.10.0 - 2020-04-18
8414 -------------------
8415
8416 This release improves our support for datetimes and times around DST transitions.
8417
8418 :func:`~hypothesis.strategies.times` and :func:`~hypothesis.strategies.datetimes`
8419 are now sometimes generated with ``fold=1``, indicating that they represent the
8420 second occurrence of a given wall-time when clocks are set backwards.
8421 This may be set even when there is no transition, in which case the ``fold``
8422 value should be ignored.
8423
8424 For consistency, timezones provided by the :pypi:`pytz` package can now
8425 generate imaginary times (such as the hour skipped over when clocks 'spring forward'
8426 to daylight saving time, or during some historical timezone transitions).
8427 All other timezones have always supported generation of imaginary times.
8428
8429 If you prefer the previous behaviour, :func:`~hypothesis.strategies.datetimes`
8430 now takes an argument ``allow_imaginary`` which defaults to ``True`` but
8431 can be set to ``False`` for any timezones strategy.
8432
8433 .. _v5.9.1:
8434
8435 ------------------
8436 5.9.1 - 2020-04-16
8437 ------------------
8438
8439 This patch fixes the rendering of :func:`~hypothesis.strategies.binary`
8440 docstring by using the proper backticks syntax.
8441
8442 .. _v5.9.0:
8443
8444 ------------------
8445 5.9.0 - 2020-04-15
8446 ------------------
8447
8448 Failing tests which use :func:`~hypothesis.target` now report the highest
8449 score observed for each target alongside the failing example(s), even without
8450 :ref:`explicitly showing test statistics <statistics>`.
8451
8452 This improves the debugging workflow for tests of accuracy, which assert that the
8453 total imprecision is within some error budget - for example, ``abs(a - b) < 0.5``.
8454 Previously, shrinking to a minimal failing example could often make errors seem
8455 smaller or more subtle than they really are (see `the threshold problem
8456 <https://hypothesis.works/articles/threshold-problem/>`__, and :issue:`2180`).
8457
8458 .. _v5.8.6:
8459
8460 ------------------
8461 5.8.6 - 2020-04-15
8462 ------------------
8463
8464 This patch improves the docstring of :func:`~hypothesis.strategies.binary`,
8465 the :func:`python:repr` of :func:`~hypothesis.strategies.sampled_from` on
8466 an :class:`python:enum.Enum` subclass, and a warning in our pytest plugin.
8467 There is no change in runtime behaviour.
8468
8469 .. _v5.8.5:
8470
8471 ------------------
8472 5.8.5 - 2020-04-15
8473 ------------------
8474
8475 This release (potentially very significantly) improves the performance of failing tests in some rare cases,
8476 mostly only relevant when using :ref:`targeted property-based testing <targeted>`,
8477 by stopping further optimisation of unrelated test cases once a failing example is found.
8478
8479 .. _v5.8.4:
8480
8481 ------------------
8482 5.8.4 - 2020-04-14
8483 ------------------
8484
8485 This release fixes :issue:`2395`, where under some circumstances targeted property-based testing could cause Hypothesis to get caught in an infinite loop.
8486
8487 .. _v5.8.3:
8488
8489 ------------------
8490 5.8.3 - 2020-04-12
8491 ------------------
8492
8493 This patch teaches :func:`~hypothesis.strategies.builds` and
8494 :func:`~hypothesis.strategies.from_type` to use the ``__signature__``
8495 attribute of classes where it has been set, improving our support
8496 for :pypi:`pydantic` models (`in pydantic >= 1.5
8497 <https://github.com/pydantic/pydantic/pull/1034>`__).
8498
8499 .. _v5.8.2:
8500
8501 ------------------
8502 5.8.2 - 2020-04-12
8503 ------------------
8504
8505 This release improves the performance of the part of the core engine that
8506 deliberately generates duplicate values.
8507
8508 .. _v5.8.1:
8509
8510 ------------------
8511 5.8.1 - 2020-04-12
8512 ------------------
8513
8514 This patch improves :func:`~hypothesis.strategies.dates` shrinking, to simplify
8515 year, month, and day like :func:`~hypothesis.strategies.datetimes` rather than
8516 minimizing the number of days since 2000-01-01.
8517
8518 .. _v5.8.0:
8519
8520 ------------------
8521 5.8.0 - 2020-03-24
8522 ------------------
8523
8524 This release adds a :ref:`.hypothesis.fuzz_one_input <fuzz_one_input>`
8525 attribute to :func:`@given <hypothesis.given>` tests, for easy integration
8526 with external fuzzers such as `python-afl <https://github.com/jwilk/python-afl>`__
8527 (supporting :issue:`171`).
8528
8529 .. _v5.7.2:
8530
8531 ------------------
8532 5.7.2 - 2020-03-24
8533 ------------------
8534
8535 This patch fixes :issue:`2341`, ensuring that the printed output from a
8536 stateful test cannot use variable names before they are defined.
8537
8538 .. _v5.7.1:
8539
8540 ------------------
8541 5.7.1 - 2020-03-23
8542 ------------------
8543
8544 This patch fixes :issue:`2375`, preventing incorrect failure when a function
8545 scoped fixture is overridden with a higher scoped fixture.
8546
8547 .. _v5.7.0:
8548
8549 ------------------
8550 5.7.0 - 2020-03-19
8551 ------------------
8552
8553 This release allows the :func:`~hypothesis.extra.numpy.array_dtypes` strategy
8554 to generate Numpy dtypes which have `field titles in addition to field names
8555 <https://numpy.org/doc/stable/user/basics.rec.html#field-titles>`__.
8556 We expect this to expose latent bugs where code expects that
8557 ``set(dtype.names) == set(dtype.fields)``, though the latter may include titles.
8558
8559 .. _v5.6.1:
8560
8561 ------------------
8562 5.6.1 - 2020-03-18
8563 ------------------
8564
8565 This makes ``model`` a positional-only argument to
8566 :func:`~hypothesis.extra.django.from_model`, to support models
8567 with a field literally named "model" (:issue:`2369`).
8568
8569 .. _v5.6.0:
8570
8571 ------------------
8572 5.6.0 - 2020-02-29
8573 ------------------
8574
8575 This release adds an explicit warning for tests that are both decorated with
8576 :func:`@given(...) <hypothesis.given>` and request a
8577 :doc:`function-scoped pytest fixture <pytest:how-to/fixtures>`, because such fixtures
8578 are only executed once for *all* Hypothesis test cases and that often causes
8579 trouble (:issue:`377`).
8580
8581 It's *very* difficult to fix this on the :pypi:`pytest` side, so since 2015
8582 our advice has been "just don't use function-scoped fixtures with Hypothesis".
8583 Now we detect and warn about the issue at runtime!
8584
8585 .. _v5.5.5:
8586
8587 ------------------
8588 5.5.5 - 2020-02-29
8589 ------------------
8590
8591 This release cleans up the internal machinery for :ref:`stateful`,
8592 after we dropped the legacy APIs in Hypothesis 5.0 (:issue:`2218`).
8593 There is no user-visible change.
8594
8595 .. _v5.5.4:
8596
8597 ------------------
8598 5.5.4 - 2020-02-16
8599 ------------------
8600
8601 This patch fixes :issue:`2351`, :func:`~hypothesis.extra.numpy.arrays` would
8602 raise a confusing error if we inferred a strategy for ``datetime64`` or
8603 ``timedelta64`` values with varying time units.
8604
8605 We now infer an internally-consistent strategy for such arrays, and have a more
8606 helpful error message if an inconsistent strategy is explicitly specified.
8607
8608 .. _v5.5.3:
8609
8610 ------------------
8611 5.5.3 - 2020-02-14
8612 ------------------
8613
8614 This patch improves the signature of :func:`~hypothesis.strategies.builds` by
8615 specifying ``target`` as a positional-only argument on Python 3.8 (see :pep:`570`).
8616 The semantics of :func:`~hypothesis.strategies.builds` have not changed at all -
8617 this just clarifies the documentation.
8618
8619 .. _v5.5.2:
8620
8621 ------------------
8622 5.5.2 - 2020-02-13
8623 ------------------
8624
8625 This release makes Hypothesis faster at generating test cases that contain
8626 duplicated values in their inputs.
8627
8628 .. _v5.5.1:
8629
8630 ------------------
8631 5.5.1 - 2020-02-07
8632 ------------------
8633
8634 This patch has some tiny internal code clean-ups, with no user-visible change.
8635
8636 .. _v5.5.0:
8637
8638 ------------------
8639 5.5.0 - 2020-02-07
8640 ------------------
8641
8642 :gh-file:`Our style guide <guides/api-style.rst>` suggests that optional
8643 parameters should usually be keyword-only arguments (see :pep:`3102`) to
8644 prevent confusion based on positional arguments - for example,
8645 :func:`hypothesis.strategies.floats` takes up to *four* boolean flags
8646 and many of the Numpy strategies have both ``dims`` and ``side`` bounds.
8647
8648 This release converts most optional parameters in our API to use
8649 keyword-only arguments - and adds a compatibility shim so you get
8650 warnings rather than errors everywhere (:issue:`2130`).
8651
8652 .. _v5.4.2:
8653
8654 ------------------
8655 5.4.2 - 2020-02-06
8656 ------------------
8657
8658 This patch fixes compatibility with Python 3.5.2 (:issue:`2334`).
8659 Note that :doc:`we only test the latest patch of each minor version <compatibility>`,
8660 though as in this case we usually accept pull requests for older patch versions.
8661
8662 .. _v5.4.1:
8663
8664 ------------------
8665 5.4.1 - 2020-02-01
8666 ------------------
8667
8668 This patch improves the repr of :func:`~hypothesis.strategies.from_type`,
8669 so that in most cases it will display the strategy it resolves to rather
8670 than ``from_type(...)``. The latter form will continue to be used where
8671 resolution is not immediately successful, e.g. invalid arguments or
8672 recursive type definitions involving forward references.
8673
8674 .. _v5.4.0:
8675
8676 ------------------
8677 5.4.0 - 2020-01-30
8678 ------------------
8679
8680 This release removes support for Python 3.5.0 and 3.5.1, where the
8681 :mod:`python:typing` module was quite immature (e.g. missing
8682 :func:`~python:typing.overload` and :obj:`~python:typing.Type`).
8683
8684 Note that Python 3.5 will reach its end-of-life in September 2020,
8685 and new releases of Hypothesis may drop support somewhat earlier.
8686
8687 .. note::
8688 ``pip install hypothesis`` should continue to give you the latest compatible version.
8689 If you have somehow ended up with an incompatible version, you need to update your
8690 packaging stack to ``pip >= 9.0`` and ``setuptools >= 24.2`` - see `here for details
8691 <https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires>`__.
8692 Then ``pip uninstall hypothesis && pip install hypothesis`` will get you back to
8693 a compatible version.
8694
8695 .. _v5.3.1:
8696
8697 ------------------
8698 5.3.1 - 2020-01-26
8699 ------------------
8700
8701 This patch does some minor internal cleanup; there is no user-visible change.
8702
8703 .. _v5.3.0:
8704
8705 ------------------
8706 5.3.0 - 2020-01-21
8707 ------------------
8708
8709 The standard library :mod:`ipaddress` module is new in Python 3, and this release
8710 adds the new :func:`~hypothesis.strategies.ip_addresses` strategy to generate
8711 :class:`~python:ipaddress.IPv4Address`\ es and/or
8712 :class:`~python:ipaddress.IPv6Address`\ es (depending on the ``v`` and ``network``
8713 arguments).
8714
8715 If you use them in type annotations, :func:`~hypothesis.strategies.from_type` now
8716 has strategies registered for :mod:`ipaddress` address, network, and interface types.
8717
8718 The provisional strategies for IP address strings are therefore deprecated.
8719
8720 .. _v5.2.1:
8721
8722 ------------------
8723 5.2.1 - 2020-01-21
8724 ------------------
8725
8726 This patch reverts :ref:`version 5.2 <v5.2.0>`, due to a
8727 `strange issue <https://github.com/numpy/numpy/issues/15363>`__
8728 where indexing an array of strings can raise an error instead of
8729 returning an item which contains certain surrogate characters.
8730
8731 .. _v5.2.0:
8732
8733 ------------------
8734 5.2.0 - 2020-01-19
8735 ------------------
8736
8737 This release allows :func:`~hypothesis.extra.numpy.from_dtype` to generate
8738 Unicode strings which cannot be encoded in UTF-8, but are valid in Numpy
8739 arrays (which use UTF-32).
8740
8741 .. _v5.1.6:
8742
8743 ------------------
8744 5.1.6 - 2020-01-19
8745 ------------------
8746
8747 This patch fixes :issue:`2320`, where ``from_type(Set[Hashable])`` could raise
8748 an internal error because ``Decimal("snan")`` is of a hashable type, but raises
8749 an error when hashed. We now ensure that set elements and dict keys in generic
8750 types can actually be hashed.
8751
8752 .. _v5.1.5:
8753
8754 ------------------
8755 5.1.5 - 2020-01-12
8756 ------------------
8757
8758 This patch fixes an internal error when running in an :pypi:`ipython` repl or
8759 :pypi:`jupyter` notebook on Windows (:issue:`2319`), and an internal error on
8760 Python 3.5.1 (:issue:`2318`).
8761
8762 .. _v5.1.4:
8763
8764 ------------------
8765 5.1.4 - 2020-01-11
8766 ------------------
8767
8768 This patch fixes a bug where errors in third-party extensions such as
8769 :pypi:`hypothesis-trio` or :pypi:`hypothesis-jsonschema` were incorrectly
8770 considered to be Hypothesis internal errors, which could result in
8771 confusing error messages.
8772
8773 Thanks to Vincent Michel for reporting and fixing the bug!
8774
8775 .. _v5.1.3:
8776
8777 ------------------
8778 5.1.3 - 2020-01-11
8779 ------------------
8780
8781 This release converts the type hint comments on our public API to
8782 :pep:`484` type annotations.
8783
8784 Thanks to Ivan Levkivskyi for :pypi:`com2ann` - with the refactoring
8785 tools from :ref:`5.0.1 <v5.0.1>` it made this process remarkably easy!
8786
8787 .. _v5.1.2:
8788
8789 ------------------
8790 5.1.2 - 2020-01-09
8791 ------------------
8792
8793 This patch makes :func:`~hypothesis.stateful.multiple` iterable, so that
8794 output like ``a, b = state.some_rule()`` is actually executable and
8795 can be used to reproduce failing examples.
8796
8797 Thanks to Vincent Michel for reporting and fixing :issue:`2311`!
8798
8799 .. _v5.1.1:
8800
8801 ------------------
8802 5.1.1 - 2020-01-06
8803 ------------------
8804
8805 This patch contains many small refactorings to replace our Python 2
8806 compatibility functions with their native Python 3 equivalents.
8807 Since Hypothesis is now Python 3 only, there is no user-visible change.
8808
8809 .. _v5.1.0:
8810
8811 ------------------
8812 5.1.0 - 2020-01-03
8813 ------------------
8814
8815 This release teaches :func:`~hypothesis.strategies.from_type` how to generate
8816 :class:`python:datetime.timezone`. As a result, you can now generate
8817 :class:`python:datetime.tzinfo` objects without having :pypi:`pytz` installed.
8818
8819 If your tests specifically require :pypi:`pytz` timezones, you should be using
8820 :func:`hypothesis.extra.pytz.timezones` instead of ``st.from_type(tzinfo)``.
8821
8822 .. _v5.0.1:
8823
8824 ------------------
8825 5.0.1 - 2020-01-01
8826 ------------------
8827
8828 This patch contains mostly-automated refactorings to remove code
8829 that we only needed to support Python 2. Since Hypothesis is now
8830 Python 3 only (hurray!), there is no user-visible change.
8831
8832 Our sincere thanks to the authors of :pypi:`autoflake`, :pypi:`black`,
8833 :pypi:`isort`, and :pypi:`pyupgrade`, who have each and collectively
8834 made this kind of update enormously easier.
8835
8836 .. _v5.0.0:
8837
8838 ------------------
8839 5.0.0 - 2020-01-01
8840 ------------------
8841
8842 Welcome to the next major version of Hypothesis!
8843
8844 There are no new features here, as we release those in minor versions.
8845 Instead, 5.0 is a chance for us to remove deprecated features (many already
8846 converted into no-ops), and turn a variety of warnings into errors.
8847
8848 If you were running on the last version of Hypothesis 4.x *without any
8849 Hypothesis deprecation warnings*, this will be a very boring upgrade.
8850 **In fact, nothing will change for you at all.**
8851
8852 .. note::
8853 This release drops support for Python 2, which has passed
8854 `its end of life date <https://devguide.python.org/#status-of-python-branches>`__.
8855 The `Python 3 Statement <https://python3statement.github.io>`__ outlines our
8856 reasons, and lists many other packages that have made the same decision.
8857
8858 ``pip install hypothesis`` should continue to give you the latest compatible version.
8859 If you have somehow ended up with Hypothesis 5.0 on Python 2, you need to update your
8860 packaging stack to ``pip >= 9.0`` and ``setuptools >= 24.2`` - see `here for details
8861 <https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires>`__.
8862 Then ``pip uninstall hypothesis && pip install hypothesis`` will get you back to
8863 a compatible version.
8864
8865
8866 Strategies
8867 ~~~~~~~~~~
8868 - :func:`~hypothesis.strategies.integers` bounds must be equal to an integer,
8869 though they can still be other types.
8870 - If :func:`~hypothesis.strategies.fractions` is passed a ``max_denominator``,
8871 the bounds must have at most that denominator.
8872 - :func:`~hypothesis.strategies.floats` bounds must be exactly representable as a
8873 floating-point number with the given ``width``. If not, the error message
8874 includes the nearest such number.
8875 - :func:`sampled_from([]) <hypothesis.strategies.sampled_from>` is now an error.
8876 - The values from the ``elements`` and ``fill`` strategies for
8877 :func:`hypothesis.extra.numpy.arrays` must be losslessly representable in an
8878 array of the given dtype.
8879 - The ``min_size`` and ``max_size`` arguments to all collection strategies must
8880 be of type :class:`python:int` (or ``max_size`` may be ``None``).
8881
8882 Miscellaneous
8883 ~~~~~~~~~~~~~
8884 - The ``.example()`` method of strategies (intended for interactive
8885 exploration) no longer takes a ``random`` argument.
8886 - It is now an error to apply :obj:`@example <hypothesis.example>`,
8887 :func:`@seed <hypothesis.seed>`, or :func:`@reproduce_failure <hypothesis.reproduce_failure>`
8888 without also applying :func:`@given <hypothesis.given>`.
8889 - You may pass either the ``target`` or ``targets`` argument to stateful rules, but not both.
8890 - :obj:`~hypothesis.settings.deadline` must be ``None`` (to disable), a
8891 :class:`~python:datetime.timedelta`, or an integer or float number of milliseconds.
8892 - Both of :obj:`~hypothesis.settings.derandomize` and
8893 :obj:`~hypothesis.settings.print_blob` must be either ``True`` or ``False``,
8894 where they previously accepted other values.
8895 - :obj:`~hypothesis.settings.stateful_step_count` must be at least one.
8896 - :obj:`~hypothesis.settings.max_examples` must be at least one.
8897 To disable example generation, use the :obj:`~hypothesis.settings.phases` setting.
8898
8899 Removals
8900 ~~~~~~~~
8901 - ``hypothesis.stateful.GenericStateMachine`` in favor of :class:`hypothesis.stateful.RuleBasedStateMachine`
8902 - ``hypothesis.extra.django.models.models`` in favor of :func:`hypothesis.extra.django.from_model`
8903 and ``hypothesis.extra.django.models.add_default_field_mapping`` in favor of
8904 :func:`hypothesis.extra.django.register_field_strategy`
8905 - ``hypothesis.HealthCheck.hung_test``, without replacement
8906 - ``hypothesis.settings.buffer``, without replacement
8907 - ``hypothesis.PrintSettings``, because :obj:`hypothesis.settings.print_blob` takes ``True`` or ``False``
8908 - ``hypothesis.settings.timeout``, in favor of :obj:`hypothesis.settings.deadline`
8909 - ``hypothesis.unlimited`` without replacement (only useful as argument to ``timeout``)
8910
8911 Hypothesis 4.x
8912 ==============
8913
8914 .. _v4.57.1:
8915
8916 -------------------
8917 4.57.1 - 2019-12-29
8918 -------------------
8919
8920 This patch improves the type hints and documentation for the
8921 :ref:`django extra. <hypothesis-django>` There is no runtime change.
8922
8923 .. _v4.57.0:
8924
8925 -------------------
8926 4.57.0 - 2019-12-28
8927 -------------------
8928
8929 This release improves support for the SupportsOp protocols from the :mod:`python:typing`
8930 module when using on :func:`~hypothesis.strategies.from_type` as outlined in :issue:`2292`.
8931 The following types now generate much more varied strategies when called
8932 with :func:`~hypothesis.strategies.from_type`:
8933
8934 - :class:`python:typing.SupportsAbs`
8935 - :class:`python:typing.SupportsBytes`
8936 - :class:`python:typing.SupportsComplex`
8937 - :class:`python:typing.SupportsInt`
8938 - :class:`python:typing.SupportsFloat`
8939 - :class:`python:typing.SupportsRound`
8940
8941 Note that using :func:`~hypothesis.strategies.from_type` with one of the above strategies will not
8942 ensure that the specified function will execute successfully (ie : the strategy returned for
8943 ``from_type(typing.SupportsAbs)`` may include NaNs or things which cause the :func:`python:abs`
8944 function to error. )
8945
8946 Thanks to Lea Provenzano for this patch.
8947
8948 .. _v4.56.3:
8949
8950 -------------------
8951 4.56.3 - 2019-12-22
8952 -------------------
8953
8954 This release fixes a small internal bug in shrinking which could have caused it
8955 to perform slightly more tests than were necessary. Fixing this shouldn't have
8956 much effect but it will make shrinking slightly faster.
8957
8958 .. _v4.56.2:
8959
8960 -------------------
8961 4.56.2 - 2019-12-21
8962 -------------------
8963
8964 This release removes an internal heuristic that was no longer providing much
8965 benefit. It is unlikely that there will be any user visible effect.
8966
8967 .. _v4.56.1:
8968
8969 -------------------
8970 4.56.1 - 2019-12-19
8971 -------------------
8972
8973 This release further improves the optimisation algorithm for :ref:`targeted property-based testing <targeted>`.
8974
8975 .. _v4.56.0:
8976
8977 -------------------
8978 4.56.0 - 2019-12-18
8979 -------------------
8980
8981 This release enables deprecation warnings even when the
8982 :obj:`~hypothesis.settings.verbosity` setting is ``quiet``,
8983 in preparation for Hypothesis 5.0 (:issue:`2218`).
8984
8985 Warnings can still be filtered by the standard mechanisms
8986 provided in the standard-library :mod:`python:warnings` module.
8987
8988 .. _v4.55.4:
8989
8990 -------------------
8991 4.55.4 - 2019-12-18
8992 -------------------
8993
8994 This release improves Hypothesis's management of the set of test cases it
8995 tracks between runs. It will only do anything if you have the
8996 :obj:`~hypothesis.Phase.target` phase enabled and an example database set.
8997 In those circumstances it should result in a more thorough and faster set of examples
8998 that are tried on each run.
8999
9000 .. _v4.55.3:
9001
9002 -------------------
9003 4.55.3 - 2019-12-18
9004 -------------------
9005
9006 This release makes Hypothesis better at generating test cases where generated
9007 values are duplicated in different parts of the test case. This will be
9008 especially noticeable with reasonably complex values, as it was already able
9009 to do this for simpler ones such as integers or floats.
9010
9011 .. _v4.55.2:
9012
9013 -------------------
9014 4.55.2 - 2019-12-17
9015 -------------------
9016
9017 This release expands the set of test cases that Hypothesis saves in its
9018 database for future runs to include a representative set of "structurally
9019 different" test cases - e.g. it might try to save test cases where a given list
9020 is empty or not.
9021
9022 Currently this is unlikely to have much user visible impact except to produce
9023 slightly more consistent behaviour between consecutive runs of a test suite.
9024 It is mostly groundwork for future improvements which will exploit this
9025 functionality more effectively.
9026
9027 .. _v4.55.1:
9028
9029 -------------------
9030 4.55.1 - 2019-12-16
9031 -------------------
9032
9033 This patch fixes :issue:`2257`, where :func:`~hypothesis.strategies.from_type`
9034 could incorrectly generate bytestrings when passed a generic
9035 :class:`python:typing.Sequence` such as ``Sequence[set]``.
9036
9037 .. _v4.55.0:
9038
9039 -------------------
9040 4.55.0 - 2019-12-16
9041 -------------------
9042
9043 This release adds database support for :ref:`targeted property-based testing <targeted>`,
9044 so the best examples based on the targeting will be saved and reused between runs.
9045 This is mostly laying groundwork for future features in this area, but
9046 will also make targeted property-based tests more useful during development,
9047 where the same tests tend to get run over and over again.
9048
9049 If :obj:`~hypothesis.settings.max_examples` is large, this may increase memory
9050 usage significantly under some circumstances, but these should be relatively
9051 rare.
9052
9053 This release also adds a dependency on the :pypi:`sortedcontainers` package.
9054
9055 .. _v4.54.2:
9056
9057 -------------------
9058 4.54.2 - 2019-12-16
9059 -------------------
9060
9061 This release improves the optimisation algorithm for :ref:`targeted property-based testing <targeted>`,
9062 so that it will find higher quality results more reliably. Specifically, in cases where it would previously have got near a local optimum,
9063 it will now tend to achieve the locally optimal value.
9064
9065 .. _v4.54.1:
9066
9067 -------------------
9068 4.54.1 - 2019-12-16
9069 -------------------
9070
9071 This release is mostly internal changes in support of better testing of the
9072 core engine. You are unlikely to see much effect, although some internal
9073 heuristics have changed slightly.
9074
9075 .. _v4.54.0:
9076
9077 -------------------
9078 4.54.0 - 2019-12-15
9079 -------------------
9080
9081 This release adds a dedicated phase for :ref:`targeted property-based testing <targeted>`,
9082 and (somewhat) improves the targeting algorithm so that it will find higher quality results more reliably.
9083 This comes at a cost of making it more likely to get stuck in a local optimum.
9084
9085 .. _v4.53.3:
9086
9087 -------------------
9088 4.53.3 - 2019-12-15
9089 -------------------
9090
9091 This patch fixes :func:`~hypothesis.strategies.from_type` with
9092 :class:`python:typing.Hashable` and :class:`python:typing.Sized`,
9093 which previously failed with an internal error on Python 3.7 or later.
9094
9095 Thanks to Lea Provenzano for both reporting :issue:`2272`
9096 and writing the patch!
9097
9098 .. _v4.53.2:
9099
9100 -------------------
9101 4.53.2 - 2019-12-11
9102 -------------------
9103
9104 This release reorganises a number of the Hypothesis internal modules into a
9105 package structure. If you are only depending on the public API it should have
9106 no effect. If you are depending on the internal API (which you shouldn't be,
9107 and which we don't guarantee compatibility on) you may have to rename some
9108 imports.
9109
9110 .. _v4.53.1:
9111
9112 -------------------
9113 4.53.1 - 2019-12-09
9114 -------------------
9115
9116 This release changes the size distribution of the number of steps run in
9117 stateful testing: It will now almost always run the maximum number of steps
9118 permitted.
9119
9120 .. _v4.53.0:
9121
9122 -------------------
9123 4.53.0 - 2019-12-09
9124 -------------------
9125
9126 :ref:`statistics` now include the best score seen for each label, which can help avoid
9127 `the threshold problem <https://hypothesis.works/articles/threshold-problem/>`__ when
9128 the minimal example shrinks right down to the threshold of failure (:issue:`2180`).
9129
9130 .. _v4.52.0:
9131
9132 -------------------
9133 4.52.0 - 2019-12-09
9134 -------------------
9135
9136 This release changes the ``stateful_step_count`` setting to raise an error if
9137 set to ``0``. This is a backwards compatible change because a value of ``0``
9138 would never have worked and attempting to run it would have resulted in an
9139 internal assertion error.
9140
9141 .. _v4.51.1:
9142
9143 -------------------
9144 4.51.1 - 2019-12-09
9145 -------------------
9146
9147 This release makes a small internal change to the distribution of test cases.
9148 It is unlikely to have much user visible impact.
9149
9150 .. _v4.51.0:
9151
9152 -------------------
9153 4.51.0 - 2019-12-07
9154 -------------------
9155
9156 This release deprecates use of :obj:`@example <hypothesis.example>`,
9157 :func:`@seed <hypothesis.seed>`, or :func:`@reproduce_failure <hypothesis.reproduce_failure>`
9158 without :func:`@given <hypothesis.given>`.
9159
9160 Thanks to Nick Anyos for the patch!
9161
9162 .. _v4.50.8:
9163
9164 -------------------
9165 4.50.8 - 2019-12-05
9166 -------------------
9167
9168 This patch makes certain uses of Bundles more efficient in stateful testing (:issue:`2078`).
9169
9170 .. _v4.50.7:
9171
9172 -------------------
9173 4.50.7 - 2019-12-05
9174 -------------------
9175
9176 This release refactors some of Hypothesis's internal interfaces for representing
9177 data generation. It should have no user visible effect.
9178
9179 .. _v4.50.6:
9180
9181 -------------------
9182 4.50.6 - 2019-12-02
9183 -------------------
9184
9185 This patch removes some old debugging helpers in our Numpy extra which have
9186 not been needed since :issue:`1963` and :issue:`2245`.
9187
9188 .. _v4.50.5:
9189
9190 -------------------
9191 4.50.5 - 2019-12-01
9192 -------------------
9193
9194 This patch fixes :issue:`2229`, where Numpy arrays of unsized strings would
9195 only ever have strings of size one due to an interaction between our generation
9196 logic and Numpy's allocation strategy.
9197
9198 .. _v4.50.4:
9199
9200 -------------------
9201 4.50.4 - 2019-12-01
9202 -------------------
9203
9204 This patch fixes a rare internal error in strategies for a list of
9205 unique items sampled from a short non-unique sequence (:issue:`2247`).
9206 The bug was discovered via :pypi:`hypothesis-jsonschema`.
9207
9208 .. _v4.50.3:
9209
9210 -------------------
9211 4.50.3 - 2019-12-01
9212 -------------------
9213
9214 This release improves the error message when
9215 :func:`@settings <hypothesis.settings>` tries to inherit settings from a
9216 ``parent`` argument that isn't a ``settings`` instance.
9217
9218 .. _v4.50.2:
9219
9220 -------------------
9221 4.50.2 - 2019-11-29
9222 -------------------
9223
9224 This release improves Hypothesis's "Falsifying example" output, by breaking
9225 output across multiple lines where necessary, and by removing irrelevant
9226 information from the stateful testing output.
9227
9228 .. _v4.50.1:
9229
9230 -------------------
9231 4.50.1 - 2019-11-29
9232 -------------------
9233
9234 This patch adds :pypi:`flake8-comprehensions` to our linter suite. There is no
9235 user-visible change - expect perhaps via some strange microbenchmarks - but
9236 certain parts of the code now have a clear and more consistent style.
9237
9238 .. _v4.50.0:
9239
9240 -------------------
9241 4.50.0 - 2019-11-28
9242 -------------------
9243
9244 This release fixes some cases where we might previously have failed to run the
9245 validation logic for some strategies. As a result tests which would previously
9246 have been silently testing significantly less than they should may now start
9247 to raise ``InvalidArgument`` now that these errors are caught.
9248
9249 .. _v4.49.0:
9250
9251 -------------------
9252 4.49.0 - 2019-11-28
9253 -------------------
9254
9255 This release significantly improves the data distribution in :ref:`rule based stateful testing <stateful>`,
9256 by using a technique called `Swarm Testing (Groce, Alex, et al. "Swarm testing."
9257 Proceedings of the 2012 International Symposium on Software Testing and Analysis. ACM, 2012.) <https://agroce.github.io/issta12.pdf>`_
9258 to select which rules are run in any given test case. This should allow it to find many issues that it would previously have missed.
9259
9260 This change is likely to be especially beneficial for stateful tests with large numbers of rules.
9261
9262 .. _v4.48.1:
9263
9264 -------------------
9265 4.48.1 - 2019-11-28
9266 -------------------
9267
9268 This release adds some heuristics to test case generation that try to ensure that test cases generated early on will be relatively small.
9269
9270 This fixes a bug introduced in :ref:`Hypothesis 4.42.0 <v4.42.0>` which would cause occasional
9271 :obj:`~hypothesis.HealthCheck.too_slow` failures on some tests.
9272
9273 .. _v4.48.0:
9274
9275 -------------------
9276 4.48.0 - 2019-11-28
9277 -------------------
9278
9279 This release revokes the deprecation of ``find``, as we've now rebuilt it on top of
9280 ``@given``, which means it has minimal maintenance burden and we're happy to support it.
9281
9282 .. _v4.47.5:
9283
9284 -------------------
9285 4.47.5 - 2019-11-28
9286 -------------------
9287
9288 This release rebuilds ``find()`` on top of ``@given`` in order to have more code in common.
9289 It should have minimal user visible effect.
9290
9291 .. _v4.47.4:
9292
9293 -------------------
9294 4.47.4 - 2019-11-27
9295 -------------------
9296
9297 This patch removes an internal compatibility shim that we no longer need.
9298
9299 .. _v4.47.3:
9300
9301 -------------------
9302 4.47.3 - 2019-11-26
9303 -------------------
9304
9305 This patch fixes several typos in our docstrings and comments,
9306 with no change in behaviour. Thanks to Dmitry Dygalo for
9307 identifying and fixing them!
9308
9309 .. _v4.47.2:
9310
9311 -------------------
9312 4.47.2 - 2019-11-25
9313 -------------------
9314
9315 This release fixes an internal issue where Hypothesis would sometimes generate
9316 test cases that were above its intended maximum size. This would only have
9317 happened rarely and probably would not have caused major problems when it did.
9318
9319 Users of the new :ref:`targeted property-based testing <targeted>` might
9320 see minor impact (possibly slightly faster tests and slightly worse target scores),
9321 but only in the unlikely event that they were hitting this problem. Other users
9322 should not see any effect at all.
9323
9324 .. _v4.47.1:
9325
9326 -------------------
9327 4.47.1 - 2019-11-24
9328 -------------------
9329
9330 This release removes some unused code from the core engine.
9331 There is no user-visible change.
9332
9333 .. _v4.47.0:
9334
9335 -------------------
9336 4.47.0 - 2019-11-24
9337 -------------------
9338
9339 This release commonizes some code between running explicit examples and normal test execution.
9340 The main user visible impact of this is that deadlines are now enforced when running explicit examples.
9341
9342 .. _v4.46.1:
9343
9344 -------------------
9345 4.46.1 - 2019-11-23
9346 -------------------
9347
9348 This patch ensures that a KeyboardInterrupt received during example generation
9349 is not treated as a mystery test failure but instead propagates to the top
9350 level, not recording the interrupted generation in the conjecture data tree.
9351 Thanks to Anne Archibald for identifying and fixing the problem.
9352
9353 .. _v4.46.0:
9354
9355 -------------------
9356 4.46.0 - 2019-11-22
9357 -------------------
9358
9359 This release changes the behaviour of :func:`~hypothesis.strategies.floats`
9360 when excluding signed zeros - ``floats(max_value=0.0, exclude_max=True)``
9361 can no longer generate ``-0.0`` nor the much rarer
9362 ``floats(min_value=-0.0, exclude_min=True)`` generate ``+0.0``.
9363
9364 The correct interaction between signed zeros and exclusive endpoints was unclear;
9365 we now enforce the invariant that :func:`~hypothesis.strategies.floats` will
9366 never generate a value equal to an excluded endpoint (:issue:`2201`).
9367
9368 If you prefer the old behaviour, you can pass ``floats(max_value=-0.0)`` or
9369 ``floats(min_value=0.0)`` which is exactly equivalent and has not changed.
9370 If you had *two* endpoints equal to zero, we recommend clarifying your tests by using
9371 :func:`~hypothesis.strategies.just` or :func:`~hypothesis.strategies.sampled_from`
9372 instead of :func:`~hypothesis.strategies.floats`.
9373
9374 .. _v4.45.1:
9375
9376 -------------------
9377 4.45.1 - 2019-11-20
9378 -------------------
9379
9380 This patch improves the error message when invalid arguments are passed
9381 to :func:`~hypothesis.stateful.rule` or :func:`~hypothesis.stateful.invariant`
9382 (:issue:`2149`).
9383
9384 Thanks to Benjamin Palmer for this bugfix!
9385
9386 .. _v4.45.0:
9387
9388 -------------------
9389 4.45.0 - 2019-11-20
9390 -------------------
9391
9392 This release supports :obj:`python:typing.Final` and :obj:`python:typing.TypedDict`
9393 in :func:`~hypothesis.strategies.from_type`.
9394
9395 .. _v4.44.5:
9396
9397 -------------------
9398 4.44.5 - 2019-11-20
9399 -------------------
9400
9401 This patch disables our :pypi:`pytest` plugin when running on versions
9402 of :pypi:`pytest` before 4.3, the oldest our plugin supports.
9403 Note that at time of writing the Pytest developers only support 4.6 and later!
9404
9405 Hypothesis *tests* using :func:`@given() <hypothesis.given>` work on any
9406 test runner, but our integrations to e.g. avoid example database collisions
9407 when combined with ``@pytest.mark.parametrize`` eventually drop support
9408 for obsolete versions.
9409
9410 .. _v4.44.4:
9411
9412 -------------------
9413 4.44.4 - 2019-11-20
9414 -------------------
9415
9416 This patch adds some internal comments and clarifications to the Hypothesis
9417 implementation. There is no user-visible change.
9418
9419 .. _v4.44.3:
9420
9421 -------------------
9422 4.44.3 - 2019-11-20
9423 -------------------
9424
9425 This patch avoids importing test runners such as :pypi:`pytest`, :pypi:`unittest2`,
9426 or :pypi:`nose` solely to access their special "skip test" exception types -
9427 if the module is not in :obj:`sys.modules`, the exception can't be raised anyway.
9428
9429 This fixes a problem where importing an otherwise unused module could cause
9430 spurious errors due to import-time side effects (and possibly ``-Werror``).
9431
9432 .. _v4.44.2:
9433
9434 -------------------
9435 4.44.2 - 2019-11-12
9436 -------------------
9437
9438 This release fixes :func:`@given <hypothesis.given>` to only complain about
9439 missing keyword-only arguments if the associated test function is actually
9440 called.
9441
9442 This matches the behaviour of other ``InvalidArgument`` errors produced by
9443 ``@given``.
9444
9445 .. _v4.44.1:
9446
9447 -------------------
9448 4.44.1 - 2019-11-11
9449 -------------------
9450
9451 This patch allows Hypothesis to run in environments that do not specify
9452 a ``__file__``, such as a :mod:`python:zipapp` (:issue:`2196`).
9453
9454 .. _v4.44.0:
9455
9456 -------------------
9457 4.44.0 - 2019-11-11
9458 -------------------
9459
9460 This release adds a ``signature`` argument to
9461 :func:`~hypothesis.extra.numpy.mutually_broadcastable_shapes` (:issue:`2174`),
9462 which allows us to generate shapes which are valid for functions like
9463 :data:`np.matmul() <numpy:numpy.matmul>` that require shapes which are not simply broadcastable.
9464
9465 Thanks to everyone who has contributed to this feature over the last year,
9466 and a particular shout-out to Zac Hatfield-Dodds and Ryan Soklaski for
9467 :func:`~hypothesis.extra.numpy.mutually_broadcastable_shapes` and to
9468 Ryan Turner for the downstream :pypi:`hypothesis-gufunc` project.
9469
9470 .. _v4.43.9:
9471
9472 -------------------
9473 4.43.9 - 2019-11-11
9474 -------------------
9475
9476 This patch fixes :issue:`2108`, where the first test using
9477 :func:`~hypothesis.strategies.data` to draw from :func:`~hypothesis.strategies.characters`
9478 or :func:`~hypothesis.strategies.text` would be flaky due to unreliable test timings.
9479
9480 Time taken by lazy instantiation of strategies is now counted towards drawing from
9481 the strategy, rather than towards the deadline for the test function.
9482
9483 .. _v4.43.8:
9484
9485 -------------------
9486 4.43.8 - 2019-11-08
9487 -------------------
9488
9489 This release ensures that the strategies passed to
9490 :func:`@given <hypothesis.given>` are properly validated when applied to a test
9491 method inside a test class.
9492
9493 This should result in clearer error messages when some of those strategies are
9494 invalid.
9495
9496 .. _v4.43.7:
9497
9498 -------------------
9499 4.43.7 - 2019-11-08
9500 -------------------
9501
9502 This release changes how Hypothesis manages its search space in cases where it
9503 generates redundant data. This should cause it to generate significantly fewer
9504 duplicated examples (especially with short integer ranges), and may cause it to
9505 produce more useful examples in some cases (especially ones where there is a
9506 significant amount of filtering).
9507
9508 .. _v4.43.6:
9509
9510 -------------------
9511 4.43.6 - 2019-11-07
9512 -------------------
9513
9514 This patch refactors ``width`` handling in :func:`~hypothesis.strategies.floats`;
9515 you may notice small performance improvements but the main purpose is to
9516 enable work on :issue:`1704` (improving shrinking of bounded floats).
9517
9518 .. _v4.43.5:
9519
9520 -------------------
9521 4.43.5 - 2019-11-06
9522 -------------------
9523
9524 This patch removes an unused internal flag.
9525 There is no user-visible change.
9526
9527 .. _v4.43.4:
9528
9529 -------------------
9530 4.43.4 - 2019-11-05
9531 -------------------
9532
9533 This patch corrects the exception type and error message you get if you attempt
9534 to use :func:`~hypothesis.strategies.data` to draw from something which is not
9535 a strategy. This never worked, but the error is more helpful now.
9536
9537 .. _v4.43.3:
9538
9539 -------------------
9540 4.43.3 - 2019-11-05
9541 -------------------
9542
9543 We've adopted :pypi:`flake8-bugbear` to check for a few more style issues,
9544 and this patch implements the minor internal cleanups it suggested.
9545 There is no user-visible change.
9546
9547 .. _v4.43.2:
9548
9549 -------------------
9550 4.43.2 - 2019-11-05
9551 -------------------
9552
9553 This patch fixes the formatting of some documentation,
9554 but there is no change to any executed code.
9555
9556 .. _v4.43.1:
9557
9558 -------------------
9559 4.43.1 - 2019-11-04
9560 -------------------
9561
9562 Python 3.8's new :obj:`python:typing.Literal` type - see :pep:`586` for
9563 details - is now supported in :func:`~hypothesis.strategies.from_type`.
9564
9565 .. _v4.43.0:
9566
9567 -------------------
9568 4.43.0 - 2019-11-04
9569 -------------------
9570
9571 This release adds the strategy :func:`~hypothesis.extra.numpy.mutually_broadcastable_shapes`, which generates multiple array shapes that are mutually broadcast-compatible with an optional user-specified base-shape.
9572
9573 This is a generalisation of :func:`~hypothesis.extra.numpy.broadcastable_shapes`.
9574 It relies heavily on non-public internals for performance when generating and shrinking examples.
9575 We intend to support generating shapes matching a ufunc signature in a future version (:issue:`2174`).
9576
9577 Thanks to Ryan Soklaski, Zac Hatfield-Dodds, and @rdturnermtl who contributed to this new feature.
9578
9579 .. _v4.42.10:
9580
9581 --------------------
9582 4.42.10 - 2019-11-03
9583 --------------------
9584
9585 This release fixes :func:`~hypothesis.strategies.from_type` when used with
9586 bounded or constrained :obj:`python:typing.TypeVar` objects (:issue:`2094`).
9587
9588 Previously, distinct typevars with the same constraints would be treated as all
9589 single typevar, and in cases where a typevar bound was resolved to a union of
9590 subclasses this could result in mixed types being generated for that typevar.
9591
9592 .. _v4.42.9:
9593
9594 -------------------
9595 4.42.9 - 2019-11-03
9596 -------------------
9597
9598 This patch ensures that the default value :func:`~hypothesis.extra.numpy.broadcastable_shapes`
9599 chooses for ``max_dims`` is always valid (at most 32), even if you pass ``min_dims=32``.
9600
9601 .. _v4.42.8:
9602
9603 -------------------
9604 4.42.8 - 2019-11-02
9605 -------------------
9606
9607 This patch ensures that we only add profile information to the pytest header
9608 if running either pytest or Hypothesis in verbose mode, matching the
9609 `builtin cache plugin <https://docs.pytest.org/en/latest/how-to/cache.html>`__
9610 (:issue:`2155`).
9611
9612 .. _v4.42.7:
9613
9614 -------------------
9615 4.42.7 - 2019-11-02
9616 -------------------
9617
9618 This patch makes stateful step printing expand the result of a step into
9619 multiple variables when you return :func:`~hypothesis.stateful.multiple` (:issue:`2139`).
9620 Thanks to Joseph Weston for reporting and fixing this bug!
9621
9622 .. _v4.42.6:
9623
9624 -------------------
9625 4.42.6 - 2019-11-02
9626 -------------------
9627
9628 This release fixes a bug (:issue:`2166`) where a Unicode character info
9629 cache file was generated but never used on subsequent test runs, causing tests
9630 to run more slowly than they should have.
9631
9632 Thanks to Robert Knight for this bugfix!
9633
9634 .. _v4.42.5:
9635
9636 -------------------
9637 4.42.5 - 2019-11-01
9638 -------------------
9639
9640 This patch corrects some internal documentation. There is no user-visible change.
9641
9642 .. _v4.42.4:
9643
9644 -------------------
9645 4.42.4 - 2019-11-01
9646 -------------------
9647
9648 This release fixes a bug (:issue:`2160`) where decorators applied after
9649 :func:`@settings <hypothesis.settings>` and before
9650 :func:`@given <hypothesis.given>` were ignored.
9651
9652 Thanks to Tom Milligan for this bugfix!
9653
9654 .. _v4.42.3:
9655
9656 -------------------
9657 4.42.3 - 2019-10-30
9658 -------------------
9659
9660 This release updates Hypothesis's formatting to the new version of :pypi:`black`, and
9661 has absolutely no user visible effect.
9662
9663 .. _v4.42.2:
9664
9665 -------------------
9666 4.42.2 - 2019-10-30
9667 -------------------
9668
9669 This release fixes a bug in :func:`~hypothesis.strategies.recursive` which would
9670 have meant that in practice ``max_leaves`` was treated as if it was lower than
9671 it actually is - specifically it would be capped at the largest power of two
9672 smaller than it. It is now handled correctly.
9673
9674 .. _v4.42.1:
9675
9676 -------------------
9677 4.42.1 - 2019-10-30
9678 -------------------
9679
9680 Python 3.8's new :class:`python:typing.SupportsIndex` type - see :pep:`357`
9681 for details - is now supported in :func:`~hypothesis.strategies.from_type`.
9682
9683 Thanks to Grigorios Giannakopoulos for the patch!
9684
9685 .. _v4.42.0:
9686
9687 -------------------
9688 4.42.0 - 2019-10-27
9689 -------------------
9690
9691 This release significantly simplifies Hypothesis's internal logic for data
9692 generation, by removing a number of heuristics of questionable or unproven
9693 value.
9694
9695 The results of this change will vary significantly from test to test. Most
9696 test suites will see significantly faster data generation and lower memory
9697 usage. The "quality" of the generated data may go up or down depending on your
9698 particular test suites.
9699
9700 If you see any significant regressions in Hypothesis's ability to find bugs in
9701 your code as a result of this release, please file an issue to let us know.
9702
9703 Users of the new :ref:`targeted property-based testing <targeted>`
9704 functionality are reasonably likely to see *improvements* in data generation,
9705 as this release changes the search algorithm for targeted property based
9706 testing to one that is more likely to be productive than the existing approach.
9707
9708 .. _v4.41.3:
9709
9710 -------------------
9711 4.41.3 - 2019-10-21
9712 -------------------
9713
9714 This patch is to ensure that our internals remain comprehensible to
9715 :pypi:`mypy` 0.740 - there is no user-visible change.
9716
9717 .. _v4.41.2:
9718
9719 -------------------
9720 4.41.2 - 2019-10-17
9721 -------------------
9722
9723 This patch changes some internal hashes to SHA384, to better support
9724 users subject to FIPS-140. There is no user-visible API change.
9725
9726 Thanks to Paul Kehrer for this contribution!
9727
9728 .. _v4.41.1:
9729
9730 -------------------
9731 4.41.1 - 2019-10-16
9732 -------------------
9733
9734 This release makes ``--hypothesis-show-statistics`` much more useful for
9735 tests using a :class:`~hypothesis.stateful.RuleBasedStateMachine`, by
9736 simplifying the reprs so that events are aggregated correctly.
9737
9738 .. _v4.41.0:
9739
9740 -------------------
9741 4.41.0 - 2019-10-16
9742 -------------------
9743
9744 This release upgrades the :func:`~hypothesis.strategies.fixed_dictionaries`
9745 strategy to support ``optional`` keys (:issue:`1913`).
9746
9747 .. _v4.40.2:
9748
9749 -------------------
9750 4.40.2 - 2019-10-16
9751 -------------------
9752
9753 This release makes some minor internal changes in support of improving the
9754 Hypothesis test suite. It should not have any user visible impact.
9755
9756 .. _v4.40.1:
9757
9758 -------------------
9759 4.40.1 - 2019-10-14
9760 -------------------
9761
9762 This release changes how Hypothesis checks if a parameter to a test function is a mock object.
9763 It is unlikely to have any noticeable effect, but may result in a small performance improvement,
9764 especially for test functions where a mock object is being passed as the first argument.
9765
9766 .. _v4.40.0:
9767
9768 -------------------
9769 4.40.0 - 2019-10-09
9770 -------------------
9771
9772 This release fixes a bug where our example database logic did not distinguish
9773 between failing examples based on arguments from a ``@pytest.mark.parametrize(...)``.
9774 This could in theory cause data loss if a common failure overwrote a rare one, and
9775 in practice caused occasional file-access collisions in highly concurrent workloads
9776 (e.g. during a 300-way parametrize on 16 cores).
9777
9778 For internal reasons this also involves bumping the minimum supported version of
9779 :pypi:`pytest` to 4.3
9780
9781 Thanks to Peter C Kroon for the Hacktoberfest patch!
9782
9783 .. _v4.39.3:
9784
9785 -------------------
9786 4.39.3 - 2019-10-09
9787 -------------------
9788
9789 This patch improves our type hints on the :func:`~hypothesis.strategies.emails`,
9790 :func:`~hypothesis.strategies.functions`, :func:`~hypothesis.strategies.integers`,
9791 :func:`~hypothesis.strategies.iterables`, and :func:`~hypothesis.strategies.slices`
9792 strategies, as well as the ``.filter()`` method.
9793
9794 There is no runtime change, but if you use :pypi:`mypy` or a similar
9795 type-checker on your tests the results will be a bit more precise.
9796
9797 .. _v4.39.2:
9798
9799 -------------------
9800 4.39.2 - 2019-10-09
9801 -------------------
9802
9803 This patch improves the performance of unique collections such as
9804 :func:`~hypothesis.strategies.sets` of :func:`~hypothesis.strategies.just`
9805 or :func:`~hypothesis.strategies.booleans` strategies. They were already
9806 pretty good though, so you're unlikely to notice much!
9807
9808 .. _v4.39.1:
9809
9810 -------------------
9811 4.39.1 - 2019-10-09
9812 -------------------
9813
9814 If a value in a dict passed to :func:`~hypothesis.strategies.fixed_dictionaries`
9815 is not a strategy, Hypothesis now tells you which one.
9816
9817 .. _v4.39.0:
9818
9819 -------------------
9820 4.39.0 - 2019-10-07
9821 -------------------
9822
9823 This release adds the :func:`~hypothesis.extra.numpy.basic_indices` strategy,
9824 to generate `basic indexes <https://numpy.org/doc/stable/user/basics.indexing.html>`__
9825 for arrays of the specified shape (:issue:`1930`).
9826
9827 It generates tuples containing some mix of integers, :obj:`python:slice` objects,
9828 ``...`` (Ellipsis), and :obj:`numpy:numpy.newaxis`; which when used to index an array
9829 of the specified shape produce either a scalar or a shared-memory view of the array.
9830 Note that the index tuple may be longer or shorter than the array shape, and may
9831 produce a view with another dimensionality again!
9832
9833 Thanks to Lampros Mountrakis, Ryan Soklaski, and Zac Hatfield-Dodds for their
9834 collaboration on this surprisingly subtle strategy!
9835
9836 .. _v4.38.3:
9837
9838 -------------------
9839 4.38.3 - 2019-10-04
9840 -------------------
9841
9842 This patch defers creation of the ``.hypothesis`` directory until we have
9843 something to store in it, meaning that it will appear when Hypothesis is
9844 used rather than simply installed.
9845
9846 Thanks to Peter C Kroon for the Hacktoberfest patch!
9847
9848 .. _v4.38.2:
9849
9850 -------------------
9851 4.38.2 - 2019-10-02
9852 -------------------
9853
9854 This patch bumps our dependency on :pypi:`attrs` to ``>=19.2.0``;
9855 but there are no user-visible changes to Hypothesis.
9856
9857 .. _v4.38.1:
9858
9859 -------------------
9860 4.38.1 - 2019-10-01
9861 -------------------
9862
9863 This is a comment-only patch which tells :pypi:`mypy` 0.730 to ignore
9864 some internal compatibility shims we use to support older Pythons.
9865
9866 .. _v4.38.0:
9867
9868 -------------------
9869 4.38.0 - 2019-10-01
9870 -------------------
9871
9872 This release adds the :func:`hypothesis.target` function, which implements
9873 :ref:`targeted property-based testing <targeted>`
9874 (:issue:`1779`).
9875
9876 By calling :func:`~hypothesis.target` in your test function, Hypothesis can
9877 do a hill-climbing search for bugs. If you can calculate a suitable metric
9878 such as the load factor or length of a queue, this can help you find bugs with
9879 inputs that are highly improbably from unguided generation - however good our
9880 heuristics, example diversity, and deduplication logic might be. After all,
9881 those features are at work in targeted PBT too!
9882
9883 .. _v4.37.0:
9884
9885 -------------------
9886 4.37.0 - 2019-09-28
9887 -------------------
9888
9889 This release emits a warning if you use the ``.example()`` method of
9890 a strategy in a non-interactive context.
9891
9892 :func:`~hypothesis.given` is a much better choice for writing tests,
9893 whether you care about performance, minimal examples, reproducing
9894 failures, or even just the variety of inputs that will be tested!
9895
9896 .. _v4.36.2:
9897
9898 -------------------
9899 4.36.2 - 2019-09-20
9900 -------------------
9901
9902 This patch disables part of the :mod:`typing`-based inference for the
9903 :pypi:`attrs` package under Python 3.5.0, which has some incompatible
9904 internal details (:issue:`2095`).
9905
9906 .. _v4.36.1:
9907
9908 -------------------
9909 4.36.1 - 2019-09-17
9910 -------------------
9911
9912 This patch fixes a bug in strategy inference for :pypi:`attrs` classes where
9913 Hypothesis would fail to infer a strategy for attributes of a generic type
9914 such as ``Union[int, str]`` or ``List[bool]`` (:issue:`2091`).
9915
9916 Thanks to Jonathan Gayvallet for the bug report and this patch!
9917
9918 .. _v4.36.0:
9919
9920 -------------------
9921 4.36.0 - 2019-09-09
9922 -------------------
9923
9924 This patch deprecates ``min_len`` or ``max_len`` of 0 in
9925 :func:`~hypothesis.extra.numpy.byte_string_dtypes` and
9926 :func:`~hypothesis.extra.numpy.unicode_string_dtypes`.
9927 The lower limit is now 1.
9928
9929 Numpy uses a length of 0 in these dtypes to indicate an undetermined size,
9930 chosen from the data at array creation.
9931 However, as the :func:`~hypothesis.extra.numpy.arrays` strategy creates arrays
9932 before filling them, strings were truncated to 1 byte.
9933
9934 .. _v4.35.1:
9935
9936 -------------------
9937 4.35.1 - 2019-09-09
9938 -------------------
9939
9940 This patch improves the messaging that comes from invalid size arguments
9941 to collection strategies such as :func:`~hypothesis.strategies.lists`.
9942
9943 .. _v4.35.0:
9944
9945 -------------------
9946 4.35.0 - 2019-09-04
9947 -------------------
9948
9949 This release improves the :func:`~hypothesis.extra.lark.from_lark` strategy,
9950 tightening argument validation and adding the ``explicit`` argument to allow use
9951 with terminals that use ``@declare`` instead of a string or regular expression.
9952
9953 This feature is required to handle features such as indent and dedent tokens
9954 in Python code, which can be generated with the :pypi:`hypothesmith` package.
9955
9956 .. _v4.34.0:
9957
9958 -------------------
9959 4.34.0 - 2019-08-23
9960 -------------------
9961
9962 The :func:`~hypothesis.strategies.from_type` strategy now knows to look up
9963 the subclasses of abstract types, which cannot be instantiated directly.
9964
9965 This is very useful for :pypi:`hypothesmith` to support :pypi:`libCST <libcst>`.
9966
9967 .. _v4.33.1:
9968
9969 -------------------
9970 4.33.1 - 2019-08-21
9971 -------------------
9972
9973 This patch works around a crash when an incompatible version of Numpy
9974 is installed under PyPy 5.10 (Python 2.7).
9975
9976 If you are still using Python 2, please upgrade to Python 3 as soon
9977 as possible - it will be unsupported at the end of this year.
9978
9979 .. _v4.33.0:
9980
9981 -------------------
9982 4.33.0 - 2019-08-20
9983 -------------------
9984
9985 This release improves the :func:`~hypothesis.provisional.domains`
9986 strategy, as well as the :func:`~hypothesis.provisional.urls` and
9987 the :func:`~hypothesis.strategies.emails` strategies which use it.
9988 These strategies now use the full IANA list of Top Level Domains
9989 and are correct as per :rfc:`1035`.
9990
9991 Passing tests using these strategies may now fail.
9992
9993 Thanks to `TechDragon <https://github.com/techdragon>`__ for this improvement.
9994
9995 .. _v4.32.3:
9996
9997 -------------------
9998 4.32.3 - 2019-08-05
9999 -------------------
10000
10001 This patch tidies up the repr of several ``settings``-related objects,
10002 at runtime and in the documentation, and deprecates the undocumented
10003 edge case that ``phases=None`` was treated like ``phases=tuple(Phase)``.
10004
10005 It *also* fixes :func:`~hypothesis.extra.lark.from_lark` with
10006 :pypi:`lark 0.7.2 <lark-parser>` and later.
10007
10008 .. _v4.32.2:
10009
10010 -------------------
10011 4.32.2 - 2019-07-30
10012 -------------------
10013
10014 This patch updates some internal comments for :pypi:`mypy` 0.720.
10015 There is no user-visible impact.
10016
10017 .. _v4.32.1:
10018
10019 -------------------
10020 4.32.1 - 2019-07-29
10021 -------------------
10022
10023 This release changes how the shrinker represents its progress internally. For large generated test cases
10024 this should result in significantly less memory usage and possibly faster shrinking. Small generated
10025 test cases may be slightly slower to shrink but this shouldn't be very noticeable.
10026
10027 .. _v4.32.0:
10028
10029 -------------------
10030 4.32.0 - 2019-07-28
10031 -------------------
10032
10033 This release makes :func:`~hypothesis.extra.numpy.arrays` more pedantic about
10034 ``elements`` strategies that cannot be exactly represented as array elements.
10035
10036 In practice, you will see new warnings if you were using a ``float16`` or
10037 ``float32`` dtype without passing :func:`~hypothesis.strategies.floats` the
10038 ``width=16`` or ``width=32`` arguments respectively.
10039
10040 The previous behaviour could lead to silent truncation, and thus some elements
10041 being equal to an explicitly excluded bound (:issue:`1899`).
10042
10043 .. _v4.31.1:
10044
10045 -------------------
10046 4.31.1 - 2019-07-28
10047 -------------------
10048
10049 This patch changes an internal use of MD5 to SHA hashes, to better support
10050 users subject to FIPS-140. There is no user-visible or API change.
10051
10052 Thanks to Alex Gaynor for this patch.
10053
10054 .. _v4.31.0:
10055
10056 -------------------
10057 4.31.0 - 2019-07-24
10058 -------------------
10059
10060 This release simplifies the logic of the :attr:`~hypothesis.settings.print_blob` setting by removing the option to set it to ``PrintSettings.INFER``.
10061 As a result the ``print_blob`` setting now takes a single boolean value, and the use of ``PrintSettings`` is deprecated.
10062
10063 .. _v4.28.2:
10064
10065 -------------------
10066 4.28.2 - 2019-07-14
10067 -------------------
10068
10069 This patch improves the docstrings of several Hypothesis strategies, by
10070 clarifying markup and adding cross-references. There is no runtime change.
10071
10072 Thanks to Elizabeth Williams and Serah Njambi Rono for their contributions
10073 at the SciPy 2019 sprints!
10074
10075 .. _v4.28.1:
10076
10077 -------------------
10078 4.28.1 - 2019-07-12
10079 -------------------
10080
10081 This patch improves the behaviour of the :func:`~hypothesis.strategies.text`
10082 strategy when passed an ``alphabet`` which is not a strategy. The value is
10083 now interpreted as ``include_characters`` to :func:`~hypothesis.strategies.characters`
10084 instead of a sequence for :func:`~hypothesis.strategies.sampled_from`, which
10085 standardises the distribution of examples and the shrinking behaviour.
10086
10087 You can get the previous behaviour by using
10088 ``lists(sampled_from(alphabet)).map("".map)`` instead.
10089
10090 .. _v4.28.0:
10091
10092 -------------------
10093 4.28.0 - 2019-07-11
10094 -------------------
10095
10096 This release deprecates ``find()``. The ``.example()`` method is a better
10097 replacement if you want *an* example, and for the rare occasions where you
10098 want the *minimal* example you can get it from :func:`@given <hypothesis.given>`.
10099
10100 :func:`@given <hypothesis.given>` has steadily outstripped ``find()`` in both
10101 features and performance over recent years, and as we do not have the resources
10102 to maintain and test both we think it is better to focus on just one.
10103
10104 .. _v4.27.0:
10105
10106 -------------------
10107 4.27.0 - 2019-07-08
10108 -------------------
10109
10110 This release refactors the implementation of the ``.example()`` method,
10111 to more accurately represent the data which will be generated by
10112 :func:`@given <hypothesis.given>`.
10113
10114 As a result, calling ``s.example()`` on an empty strategy ``s``
10115 (such as :func:`~hypothesis.strategies.nothing`) now raises ``Unsatisfiable``
10116 instead of the old ``NoExamples`` exception.
10117
10118 .. _v4.26.4:
10119
10120 -------------------
10121 4.26.4 - 2019-07-07
10122 -------------------
10123
10124 This patch ensures that the Pandas extra will keep working when Python 3.8
10125 removes abstract base classes from the top-level :obj:`python:collections`
10126 namespace. This also fixes the relevant warning in Python 3.7, but there
10127 is no other difference in behaviour and you do not need to do anything.
10128
10129 .. _v4.26.3:
10130
10131 -------------------
10132 4.26.3 - 2019-07-05
10133 -------------------
10134
10135 This release fixes :issue:`2027`, by changing the way Hypothesis tries to generate distinct examples to be more efficient.
10136
10137 This may result in slightly different data distribution, and should improve generation performance in general,
10138 but should otherwise have minimal user impact.
10139
10140 .. _v4.26.2:
10141
10142 -------------------
10143 4.26.2 - 2019-07-04
10144 -------------------
10145
10146 This release fixes :issue:`1864`, where some simple tests would perform very slowly,
10147 because they would run many times with each subsequent run being progressively slower.
10148 They will now stop after a more reasonable number of runs without hitting this problem.
10149
10150 Unless you are hitting exactly this issue, it is unlikely that this release will have any effect,
10151 but certain classes of custom generators that are currently very slow may become a bit faster,
10152 or start to trigger health check failures.
10153
10154 .. _v4.26.1:
10155
10156 -------------------
10157 4.26.1 - 2019-07-04
10158 -------------------
10159
10160 This release adds the strategy :func:`~hypothesis.extra.numpy.integer_array_indices`,
10161 which generates tuples of Numpy arrays that can be used for
10162 `advanced indexing <http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/AdvancedIndexing.html#Integer-Array-Indexing>`_
10163 to select an array of a specified shape.
10164
10165 .. _v4.26.0:
10166
10167 -------------------
10168 4.26.0 - 2019-07-04
10169 -------------------
10170
10171 This release significantly improves the performance of drawing unique collections whose
10172 elements are drawn from :func:`~hypothesis.strategies.sampled_from` strategies.
10173
10174 As a side effect, this detects an error condition that would previously have
10175 passed silently: When the ``min_size`` argument on a collection with distinct elements
10176 is greater than the number of elements being sampled, this will now raise an error.
10177
10178 .. _v4.25.1:
10179
10180 -------------------
10181 4.25.1 - 2019-07-03
10182 -------------------
10183
10184 This release removes some defunct internal functionality that was only being used
10185 for testing. It should have no user visible impact.
10186
10187 .. _v4.25.0:
10188
10189 -------------------
10190 4.25.0 - 2019-07-03
10191 -------------------
10192
10193 This release deprecates and disables the ``buffer_size`` setting,
10194 which should have been treated as a private implementation detail
10195 all along. We recommend simply deleting this settings argument.
10196
10197 .. _v4.24.6:
10198
10199 -------------------
10200 4.24.6 - 2019-06-26
10201 -------------------
10202
10203 This patch makes :func:`~hypothesis.strategies.datetimes` more efficient,
10204 as it now handles short months correctly by construction instead of filtering.
10205
10206 .. _v4.24.5:
10207
10208 -------------------
10209 4.24.5 - 2019-06-23
10210 -------------------
10211
10212 This patch improves the development experience by simplifying the tracebacks
10213 you will see when e.g. you have used the ``.map(...)`` method of a strategy
10214 and the mapped function raises an exception.
10215
10216 No new exceptions can be raised, nor existing exceptions change anything but
10217 their traceback. We're simply using if-statements rather than exceptions for
10218 control flow in a certain part of the internals!
10219
10220 .. _v4.24.4:
10221
10222 -------------------
10223 4.24.4 - 2019-06-21
10224 -------------------
10225
10226 This patch fixes :issue:`2014`, where our compatibility layer broke with version
10227 3.7.4 of the :pypi:`typing` module backport on PyPI.
10228
10229 This issue only affects Python 2. We remind users that Hypothesis, like many other
10230 packages, `will drop Python 2 support on 2020-01-01 <https://python3statement.github.io>`__
10231 and already has several features that are only available on Python 3.
10232
10233 .. _v4.24.3:
10234
10235 -------------------
10236 4.24.3 - 2019-06-07
10237 -------------------
10238
10239 This patch improves the implementation of an internal wrapper on Python 3.8
10240 beta1 (and will break on the alphas; but they're not meant to be stable).
10241 On other versions, there is no change at all.
10242
10243 Thanks to Daniel Hahler for the patch, and Victor Stinner for his work
10244 on :bpo:`37032` that made it possible.
10245
10246 .. _v4.24.2:
10247
10248 -------------------
10249 4.24.2 - 2019-06-06
10250 -------------------
10251
10252 Deprecation messages for functions in ``hypothesis.extra.django.models`` now
10253 explicitly name the deprecated function to make it easier to track down usages.
10254 Thanks to Kristian Glass for this contribution!
10255
10256 .. _v4.24.1:
10257
10258 -------------------
10259 4.24.1 - 2019-06-04
10260 -------------------
10261
10262 This patch fixes :issue:`1999`, a spurious bug raised when a :func:`@st.composite <hypothesis.strategies.composite>` function was passed a keyword-only argument.
10263
10264 Thanks to Jim Nicholls for his fantastic bug report.
10265
10266 .. _v4.24.0:
10267
10268 -------------------
10269 4.24.0 - 2019-05-29
10270 -------------------
10271
10272 This release deprecates ``GenericStateMachine``, in favor of
10273 :class:`~hypothesis.stateful.RuleBasedStateMachine`. Rule-based stateful
10274 testing is significantly faster, especially during shrinking.
10275
10276 If your use-case truly does not fit rule-based stateful testing,
10277 we recommend writing a custom test function which drives your specific
10278 control-flow using :func:`~hypothesis.strategies.data`.
10279
10280 .. _v4.23.9:
10281
10282 -------------------
10283 4.23.9 - 2019-05-28
10284 -------------------
10285
10286 This patch fixes a very rare example database issue with file permissions.
10287
10288 When running a test that uses both :func:`@given <hypothesis.given>`
10289 and ``pytest.mark.parametrize``, using :pypi:`pytest-xdist` on Windows,
10290 with failing examples in the database, two attempts to read a file could
10291 overlap and we caught ``FileNotFound`` but not other ``OSError``\ s.
10292
10293 .. _v4.23.8:
10294
10295 -------------------
10296 4.23.8 - 2019-05-26
10297 -------------------
10298
10299 This patch has a minor cleanup of the internal engine.
10300 There is no user-visible impact.
10301
10302 .. _v4.23.7:
10303
10304 -------------------
10305 4.23.7 - 2019-05-26
10306 -------------------
10307
10308 This patch clarifies some error messages when the test function signature
10309 is incompatible with the arguments to :func:`@given <hypothesis.given>`,
10310 especially when the :obj:`@settings() <hypothesis.settings>` decorator
10311 is also used (:issue:`1978`).
10312
10313 .. _v4.23.6:
10314
10315 -------------------
10316 4.23.6 - 2019-05-19
10317 -------------------
10318
10319 This release adds the :pypi:`pyupgrade` fixer to our code style,
10320 for consistent use of dict and set literals and comprehensions.
10321
10322 .. _v4.23.5:
10323
10324 -------------------
10325 4.23.5 - 2019-05-16
10326 -------------------
10327
10328 This release slightly simplifies a small part of the core engine.
10329 There is no user-visible change.
10330
10331 .. _v4.23.4:
10332
10333 -------------------
10334 4.23.4 - 2019-05-09
10335 -------------------
10336
10337 Fixes a minor formatting issue the docstring of :func:`~hypothesis.strategies.from_type`
10338
10339 .. _v4.23.3:
10340
10341 -------------------
10342 4.23.3 - 2019-05-09
10343 -------------------
10344
10345 Adds a recipe to the docstring of :func:`~hypothesis.strategies.from_type`
10346 that describes a means for drawing values for "everything except" a specified type.
10347 This recipe is especially useful for writing tests that perform input-type validation.
10348
10349 .. _v4.23.2:
10350
10351 -------------------
10352 4.23.2 - 2019-05-08
10353 -------------------
10354
10355 This patch uses :pypi:`autoflake` to remove some pointless ``pass`` statements,
10356 which improves our workflow but has no user-visible impact.
10357
10358 .. _v4.23.1:
10359
10360 -------------------
10361 4.23.1 - 2019-05-08
10362 -------------------
10363
10364 This patch fixes an OverflowError in
10365 :func:`from_type(xrange) <hypothesis.strategies.from_type>` on Python 2.
10366
10367 It turns out that not only do the ``start`` and ``stop`` values have to
10368 fit in a C long, but so does ``stop - start``. We now handle this even
10369 on 32bit platforms, but remind users that Python2 will not be supported
10370 after 2019 without specific funding.
10371
10372 .. _v4.23.0:
10373
10374 -------------------
10375 4.23.0 - 2019-05-08
10376 -------------------
10377
10378 This release implements the :func:`~hypothesis.strategies.slices` strategy,
10379 to generate slices of a length-``size`` sequence.
10380
10381 Thanks to Daniel J. West for writing this patch at the PyCon 2019 sprints!
10382
10383 .. _v4.22.3:
10384
10385 -------------------
10386 4.22.3 - 2019-05-07
10387 -------------------
10388
10389 This patch exposes :class:`~hypothesis.strategies.DataObject`, *solely*
10390 to support more precise type hints. Objects of this type are provided
10391 by :func:`~hypothesis.strategies.data`, and can be used to draw examples
10392 from strategies intermixed with your test code.
10393
10394 .. _v4.22.2:
10395
10396 -------------------
10397 4.22.2 - 2019-05-07
10398 -------------------
10399
10400 This patch fixes the very rare :issue:`1798` in
10401 :func:`~hypothesis.extra.numpy.array_dtypes`,
10402 which caused an internal error in our tests.
10403
10404 .. _v4.22.1:
10405
10406 -------------------
10407 4.22.1 - 2019-05-07
10408 -------------------
10409
10410 This patch fixes a rare bug in :func:`from_type(range) <hypothesis.strategies.from_type>`.
10411
10412 Thanks to Zebulun Arendsee for fixing the bug at the PyCon 2019 Sprints.
10413
10414 .. _v4.22.0:
10415
10416 -------------------
10417 4.22.0 - 2019-05-07
10418 -------------------
10419
10420 The ``unique_by`` argument to :obj:`~hypothesis.strategies.lists` now accepts a
10421 tuple of callables such that every element of the generated list will be unique
10422 with respect to each callable in the tuple (:issue:`1916`).
10423
10424 Thanks to Marco Sirabella for this feature at the PyCon 2019 sprints!
10425
10426 .. _v4.21.1:
10427
10428 -------------------
10429 4.21.1 - 2019-05-06
10430 -------------------
10431
10432 This patch cleans up the internals of :func:`~hypothesis.strategies.one_of`.
10433 You may see a slight change to the distribution of examples from this strategy
10434 but there is no change to the public API.
10435
10436 Thanks to Marco Sirabella for writing this patch at the PyCon 2019 sprints!
10437
10438 .. _v4.21.0:
10439
10440 -------------------
10441 4.21.0 - 2019-05-05
10442 -------------------
10443
10444 The :func:`~hypothesis.strategies.from_type` strategy now supports
10445 :class:`python:slice` objects.
10446
10447 Thanks to Charlie El. Awbery for writing this feature at the
10448 `PyCon 2019 Mentored Sprints <https://us.pycon.org/2019/hatchery/mentoredsprints/>`__.
10449
10450 .. _v4.20.0:
10451
10452 -------------------
10453 4.20.0 - 2019-05-05
10454 -------------------
10455
10456 This release improves the :func:`~hypothesis.extra.numpy.array_shapes`
10457 strategy, to choose an appropriate default for ``max_side`` based on the
10458 ``min_side``, and ``max_dims`` based on the ``min_dims``. An explicit
10459 error is raised for dimensions greater than 32, which are not supported
10460 by Numpy, as for other invalid combinations of arguments.
10461
10462 Thanks to Jenny Rouleau for writing this feature at the
10463 `PyCon 2019 Mentored Sprints <https://us.pycon.org/2019/hatchery/mentoredsprints/>`__.
10464
10465 .. _v4.19.0:
10466
10467 -------------------
10468 4.19.0 - 2019-05-05
10469 -------------------
10470
10471 The :func:`~hypothesis.strategies.from_type` strategy now supports
10472 :class:`python:range` objects (or ``xrange`` on Python 2).
10473
10474 Thanks to Katrina Durance for writing this feature at the
10475 `PyCon 2019 Mentored Sprints <https://us.pycon.org/2019/hatchery/mentoredsprints/>`__.
10476
10477 .. _v4.18.3:
10478
10479 -------------------
10480 4.18.3 - 2019-04-30
10481 -------------------
10482
10483 This release fixes a very rare edge case in the test-case mutator,
10484 which could cause an internal error with certain unusual tests.
10485
10486 .. _v4.18.2:
10487
10488 -------------------
10489 4.18.2 - 2019-04-30
10490 -------------------
10491
10492 This patch makes Hypothesis compatible with the Python 3.8 alpha, which
10493 changed the representation of code objects to support positional-only
10494 arguments. Note however that Hypothesis does not (yet) support such
10495 functions as e.g. arguments to :func:`~hypothesis.strategies.builds`
10496 or inputs to :func:`@given <hypothesis.given>`.
10497
10498 Thanks to Paul Ganssle for identifying and fixing this bug.
10499
10500 .. _v4.18.1:
10501
10502 -------------------
10503 4.18.1 - 2019-04-29
10504 -------------------
10505
10506 This patch improves the performance of unique collections such as
10507 :func:`~hypothesis.strategies.sets` when the elements are drawn from a
10508 :func:`~hypothesis.strategies.sampled_from` strategy (:issue:`1115`).
10509
10510 .. _v4.18.0:
10511
10512 -------------------
10513 4.18.0 - 2019-04-24
10514 -------------------
10515
10516 This release adds the :func:`~hypothesis.strategies.functions` strategy,
10517 which can be used to imitate your 'real' function for callbacks.
10518
10519 .. _v4.17.2:
10520
10521 -------------------
10522 4.17.2 - 2019-04-19
10523 -------------------
10524
10525 This release refactors stateful rule selection to share the new machinery
10526 with :func:`~hypothesis.strategies.sampled_from` instead of using the original
10527 independent implementation.
10528
10529 .. _v4.17.1:
10530
10531 -------------------
10532 4.17.1 - 2019-04-16
10533 -------------------
10534
10535 This patch allows Hypothesis to try a few more examples after finding the
10536 first bug, in hopes of reporting multiple distinct bugs. The heuristics
10537 described in :issue:`847` ensure that we avoid wasting time on fruitless
10538 searches, while still surfacing each bug as soon as possible.
10539
10540 .. _v4.17.0:
10541
10542 -------------------
10543 4.17.0 - 2019-04-16
10544 -------------------
10545
10546 This release adds the strategy :func:`~hypothesis.extra.numpy.broadcastable_shapes`,
10547 which generates array shapes that are `broadcast-compatible <https://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html#Rules-of-Broadcasting>`_
10548 with a provided shape.
10549
10550 .. _v4.16.0:
10551
10552 -------------------
10553 4.16.0 - 2019-04-12
10554 -------------------
10555
10556 This release allows :func:`~hypothesis.strategies.register_type_strategy` to be used
10557 with :obj:`python:typing.NewType` instances. This may be useful to e.g. provide
10558 only positive integers for :func:`from_type(UserId) <hypothesis.strategies.from_type>`
10559 with a ``UserId = NewType('UserId', int)`` type.
10560
10561 Thanks to PJCampi for suggesting and writing the patch!
10562
10563 .. _v4.15.0:
10564
10565 -------------------
10566 4.15.0 - 2019-04-09
10567 -------------------
10568
10569 This release supports passing a :class:`~python:datetime.timedelta` as the
10570 :obj:`~hypothesis.settings.deadline` setting, so you no longer have to remember
10571 that the number is in milliseconds (:issue:`1900`).
10572
10573 Thanks to Damon Francisco for this change!
10574
10575 .. _v4.14.7:
10576
10577 -------------------
10578 4.14.7 - 2019-04-09
10579 -------------------
10580
10581 This patch makes the type annotations on ``hypothesis.extra.dateutil``
10582 compatible with :pypi:`mypy` 0.700.
10583
10584 .. _v4.14.6:
10585
10586 -------------------
10587 4.14.6 - 2019-04-07
10588 -------------------
10589
10590 This release fixes a bug introduced in :ref:`Hypothesis 4.14.3 <v4.14.3>`
10591 that would sometimes cause
10592 :func:`sampled_from(...).filter(...) <hypothesis.strategies.sampled_from>`
10593 to encounter an internal assertion failure when there are three or fewer
10594 elements, and every element is rejected by the filter.
10595
10596 .. _v4.14.5:
10597
10598 -------------------
10599 4.14.5 - 2019-04-05
10600 -------------------
10601
10602 This patch takes the previous efficiency improvements to
10603 :func:`sampled_from(...).filter(...) <hypothesis.strategies.sampled_from>`
10604 strategies that reject most elements, and generalises them to also apply to
10605 ``sampled_from(...).filter(...).filter(...)`` and longer chains of filters.
10606
10607 .. _v4.14.4:
10608
10609 -------------------
10610 4.14.4 - 2019-04-05
10611 -------------------
10612
10613 This release fixes a bug that prevented
10614 :func:`~hypothesis.strategies.random_module`
10615 from correctly restoring the previous state of the ``random`` module.
10616
10617 The random state was instead being restored to a temporary deterministic
10618 state, which accidentally caused subsequent tests to see the same random values
10619 across multiple test runs.
10620
10621 .. _v4.14.3:
10622
10623 -------------------
10624 4.14.3 - 2019-04-03
10625 -------------------
10626
10627 This patch adds an internal special case to make
10628 :func:`sampled_from(...).filter(...) <hypothesis.strategies.sampled_from>`
10629 much more efficient when the filter rejects most elements (:issue:`1885`).
10630
10631 .. _v4.14.2:
10632
10633 -------------------
10634 4.14.2 - 2019-03-31
10635 -------------------
10636
10637 This patch improves the error message if the function ``f`` in
10638 :func:`s.flatmap(f) <hypothesis.strategies.SearchStrategy.flatmap>` does not return a strategy.
10639
10640 Thanks to Kai Chen for this change!
10641
10642 .. _v4.14.1:
10643
10644 -------------------
10645 4.14.1 - 2019-03-30
10646 -------------------
10647
10648 This release modifies how Hypothesis selects operations to run during shrinking,
10649 by causing it to deprioritise previously useless classes of shrink until others have reached a fixed point.
10650
10651 This avoids certain pathological cases where the shrinker gets very close to finishing and then takes a very long time to finish the last small changes because it tries many useless shrinks for each useful one towards the end.
10652 It also should cause a more modest improvement (probably no more than about 30%) in shrinking performance for most tests.
10653
10654 .. _v4.14.0:
10655
10656 -------------------
10657 4.14.0 - 2019-03-19
10658 -------------------
10659
10660 This release blocks installation of Hypothesis on Python 3.4, which
10661 :PEP:`reached its end of life date on 2019-03-18 <429>`.
10662
10663 This should not be of interest to anyone but downstream maintainers -
10664 if you are affected, migrate to a secure version of Python as soon as
10665 possible or at least seek commercial support.
10666
10667 .. _v4.13.0:
10668
10669 -------------------
10670 4.13.0 - 2019-03-19
10671 -------------------
10672
10673 This release makes it an explicit error to call
10674 :func:`floats(min_value=inf, exclude_min=True) <hypothesis.strategies.floats>` or
10675 :func:`floats(max_value=-inf, exclude_max=True) <hypothesis.strategies.floats>`,
10676 as there are no possible values that can be generated (:issue:`1859`).
10677
10678 :func:`floats(min_value=0.0, max_value=-0.0) <hypothesis.strategies.floats>`
10679 is now deprecated. While ``0. == -0.`` and we could thus generate either if
10680 comparing by value, violating the sequence ordering of floats is a special
10681 case we don't want or need.
10682
10683 .. _v4.12.1:
10684
10685 -------------------
10686 4.12.1 - 2019-03-18
10687 -------------------
10688
10689 This release should significantly reduce the amount of memory that Hypothesis uses for representing large test cases,
10690 by storing information in a more compact representation and only unpacking it lazily when it is first needed.
10691
10692 .. _v4.12.0:
10693
10694 -------------------
10695 4.12.0 - 2019-03-18
10696 -------------------
10697
10698 This update adds the :obj:`~hypothesis.settings.report_multiple_bugs` setting,
10699 which you can use to disable multi-bug reporting and only raise whichever bug
10700 had the smallest minimal example. This is occasionally useful when using a
10701 debugger or tools that annotate tracebacks via introspection.
10702
10703 .. _v4.11.7:
10704
10705 -------------------
10706 4.11.7 - 2019-03-18
10707 -------------------
10708
10709 This change makes a tiny improvement to the core engine's bookkeeping.
10710 There is no user-visible change.
10711
10712 .. _v4.11.6:
10713
10714 -------------------
10715 4.11.6 - 2019-03-15
10716 -------------------
10717
10718 This release changes some of Hypothesis's internal shrinking behaviour in order to reduce memory usage and hopefully improve performance.
10719
10720 .. _v4.11.5:
10721
10722 -------------------
10723 4.11.5 - 2019-03-13
10724 -------------------
10725
10726 This release adds a micro-optimisation to how Hypothesis handles debug reporting internally.
10727 Hard to shrink test may see a slight performance improvement, but in most common scenarios it is unlikely to be noticeable.
10728
10729 .. _v4.11.4:
10730
10731 -------------------
10732 4.11.4 - 2019-03-13
10733 -------------------
10734
10735 This release removes some redundant code that was no longer needed but was still running a significant amount of computation and allocation on the hot path.
10736 This should result in a modest speed improvement for most tests, especially those with large test cases.
10737
10738 .. _v4.11.3:
10739
10740 -------------------
10741 4.11.3 - 2019-03-13
10742 -------------------
10743
10744 This release adds a micro-optimisation to how Hypothesis caches test cases.
10745 This will cause a small improvement in speed and memory usage for large test cases,
10746 but in most common scenarios it is unlikely to be noticeable.
10747
10748 .. _v4.11.2:
10749
10750 -------------------
10751 4.11.2 - 2019-03-13
10752 -------------------
10753
10754 This release removes some internal code that populates a field that is no longer used anywhere.
10755 This should result in some modest performance and speed improvements and no other user visible effects.
10756
10757 .. _v4.11.1:
10758
10759 -------------------
10760 4.11.1 - 2019-03-13
10761 -------------------
10762
10763 This is a formatting-only patch, enabled by a new version of :pypi:`isort`.
10764
10765 .. _v4.11.0:
10766
10767 -------------------
10768 4.11.0 - 2019-03-12
10769 -------------------
10770
10771 This release deprecates :func:`~hypothesis.strategies.sampled_from` with empty
10772 sequences. This returns :func:`~hypothesis.strategies.nothing`, which gives a
10773 clear error if used directly... but simply vanishes if combined with another
10774 strategy.
10775
10776 Tests that silently generate less than expected are a serious problem for
10777 anyone relying on them to find bugs, and we think reliability more important
10778 than convenience in this case.
10779
10780 .. _v4.10.0:
10781
10782 -------------------
10783 4.10.0 - 2019-03-11
10784 -------------------
10785
10786 This release improves Hypothesis's to detect flaky tests, by noticing when the behaviour of the test changes between runs.
10787 In particular this will notice many new cases where data generation depends on external state (e.g. external sources of randomness) and flag those as flaky sooner and more reliably.
10788
10789 The basis of this feature is a considerable reengineering of how Hypothesis stores its history of test cases,
10790 so on top of this its memory usage should be considerably reduced.
10791
10792 .. _v4.9.0:
10793
10794 ------------------
10795 4.9.0 - 2019-03-09
10796 ------------------
10797
10798 This release adds the strategy :func:`~hypothesis.extra.numpy.valid_tuple_axes`,
10799 which generates tuples of axis-indices that can be passed to the ``axis`` argument
10800 in NumPy's sequential functions (e.g. :func:`numpy:numpy.sum`).
10801
10802 Thanks to Ryan Soklaski for this strategy.
10803
10804 .. _v4.8.0:
10805
10806 ------------------
10807 4.8.0 - 2019-03-06
10808 ------------------
10809
10810 This release significantly tightens validation in :class:`hypothesis.settings`.
10811 :obj:`~hypothesis.settings.max_examples`, ``buffer_size``,
10812 and :obj:`~hypothesis.settings.stateful_step_count` must be positive integers;
10813 :obj:`~hypothesis.settings.deadline` must be a positive number or ``None``; and
10814 :obj:`~hypothesis.settings.derandomize` must be either ``True`` or ``False``.
10815
10816 As usual, this replaces existing errors with a more helpful error and starts new
10817 validation checks as deprecation warnings.
10818
10819 .. _v4.7.19:
10820
10821 -------------------
10822 4.7.19 - 2019-03-04
10823 -------------------
10824
10825 This release makes some micro-optimisations to certain calculations performed in the shrinker.
10826 These should particularly speed up large test cases where the shrinker makes many small changes.
10827 It will also reduce the amount allocated, but most of this is garbage that would have been immediately thrown away,
10828 so you probably won't see much effect specifically from that.
10829
10830 .. _v4.7.18:
10831
10832 -------------------
10833 4.7.18 - 2019-03-03
10834 -------------------
10835
10836 This patch removes some overhead from :func:`~hypothesis.extra.numpy.arrays`
10837 with a constant shape and dtype. The resulting performance improvement is
10838 modest, but worthwhile for small arrays.
10839
10840 .. _v4.7.17:
10841
10842 -------------------
10843 4.7.17 - 2019-03-01
10844 -------------------
10845
10846 This release makes some micro-optimisations within Hypothesis's internal representation of test cases.
10847 This should cause heavily nested test cases to allocate less during generation and shrinking,
10848 which should speed things up slightly.
10849
10850 .. _v4.7.16:
10851
10852 -------------------
10853 4.7.16 - 2019-02-28
10854 -------------------
10855
10856 This changes the order in which Hypothesis runs certain operations during shrinking.
10857 This should significantly decrease memory usage and speed up shrinking of large examples.
10858
10859 .. _v4.7.15:
10860
10861 -------------------
10862 4.7.15 - 2019-02-28
10863 -------------------
10864
10865 This release allows Hypothesis to calculate a number of attributes of generated test cases lazily.
10866 This should significantly reduce memory usage and modestly improve performance,
10867 especially for large test cases.
10868
10869 .. _v4.7.14:
10870
10871 -------------------
10872 4.7.14 - 2019-02-28
10873 -------------------
10874
10875 This release reduces the number of operations the shrinker will try when reordering parts of a test case.
10876 This should in some circumstances significantly speed up shrinking. It *may* result in different final test cases,
10877 and if so usually slightly worse ones, but it should not generally have much impact on the end result as the operations removed were typically useless.
10878
10879 .. _v4.7.13:
10880
10881 -------------------
10882 4.7.13 - 2019-02-27
10883 -------------------
10884
10885 This release changes how Hypothesis reorders examples within a test case during shrinking.
10886 This should make shrinking considerably faster.
10887
10888 .. _v4.7.12:
10889
10890 -------------------
10891 4.7.12 - 2019-02-27
10892 -------------------
10893
10894 This release slightly improves the shrinker's ability to replace parts of a test case with their minimal version,
10895 by allowing it to do so in bulk rather than one at a time. Where this is effective, shrinker performance should be modestly improved.
10896
10897 .. _v4.7.11:
10898
10899 -------------------
10900 4.7.11 - 2019-02-25
10901 -------------------
10902
10903 This release makes some micro-optimisations to common operations performed during shrinking.
10904 Shrinking should now be slightly faster, especially for large examples with relatively fast test functions.
10905
10906 .. _v4.7.10:
10907
10908 -------------------
10909 4.7.10 - 2019-02-25
10910 -------------------
10911
10912 This release is a purely internal refactoring of Hypothesis's API for representing test cases.
10913 There should be no user visible effect.
10914
10915 .. _v4.7.9:
10916
10917 ------------------
10918 4.7.9 - 2019-02-24
10919 ------------------
10920
10921 This release changes certain shrink passes to make them more efficient when
10922 they aren't making progress.
10923
10924 .. _v4.7.8:
10925
10926 ------------------
10927 4.7.8 - 2019-02-23
10928 ------------------
10929
10930 This patch removes some unused code, which makes the internals
10931 a bit easier to understand. There is no user-visible impact.
10932
10933 .. _v4.7.7:
10934
10935 ------------------
10936 4.7.7 - 2019-02-23
10937 ------------------
10938
10939 This release reduces the number of operations the shrinker will try when reordering parts of a test case.
10940 This should in some circumstances significantly speed up shrinking. It *may* result in different final test cases,
10941 and if so usually slightly worse ones, but it should not generally have much impact on the end result as the operations removed were typically useless.
10942
10943 .. _v4.7.6:
10944
10945 ------------------
10946 4.7.6 - 2019-02-23
10947 ------------------
10948
10949 This patch removes some unused code from the shrinker.
10950 There is no user-visible change.
10951
10952 .. _v4.7.5:
10953
10954 ------------------
10955 4.7.5 - 2019-02-23
10956 ------------------
10957
10958 This release changes certain shrink passes to make them *adaptive* - that is,
10959 in cases where they are successfully making progress they may now do so significantly
10960 faster.
10961
10962 .. _v4.7.4:
10963
10964 ------------------
10965 4.7.4 - 2019-02-22
10966 ------------------
10967
10968 This is a docs-only patch, noting that because the :pypi:`lark-parser` is under active
10969 development at version 0.x, ``hypothesis[lark]`` APIs may break in minor
10970 releases if necessary to keep up with the upstream package.
10971
10972 .. _v4.7.3:
10973
10974 ------------------
10975 4.7.3 - 2019-02-22
10976 ------------------
10977
10978 This changes Hypothesis to no longer import various test frameworks by default (if they are installed).
10979 which will speed up the initial ``import hypothesis`` call.
10980
10981 .. _v4.7.2:
10982
10983 ------------------
10984 4.7.2 - 2019-02-22
10985 ------------------
10986
10987 This release changes Hypothesis's internal representation of a test case to calculate some expensive structural information on demand rather than eagerly.
10988 This should reduce memory usage a fair bit, and may make generation somewhat faster.
10989
10990 .. _v4.7.1:
10991
10992 ------------------
10993 4.7.1 - 2019-02-21
10994 ------------------
10995
10996 This release refactors the internal representation of previously run test cases.
10997 The main thing you should see as a result is that Hypothesis becomes somewhat less memory hungry.
10998
10999 .. _v4.7.0:
11000
11001 ------------------
11002 4.7.0 - 2019-02-21
11003 ------------------
11004
11005 This patch allows :func:`~hypothesis.extra.numpy.array_shapes` to generate shapes
11006 with side-length or even dimension zero, though the minimum still defaults to
11007 one. These shapes are rare and have some odd behavior, but are particularly
11008 important to test for just that reason!
11009
11010 In a related bigfix, :func:`~hypothesis.extra.numpy.arrays` now supports generating
11011 zero-dimensional arrays with ``dtype=object`` and a strategy for iterable elements.
11012 Previously, the array element would incorrectly be set to the first item in the
11013 generated iterable.
11014
11015 Thanks to Ryan Turner for continuing to improve our Numpy support.
11016
11017 .. _v4.6.1:
11018
11019 ------------------
11020 4.6.1 - 2019-02-19
11021 ------------------
11022
11023 This release is a trivial micro-optimisation inside Hypothesis which should result in it using significantly less memory.
11024
11025 .. _v4.6.0:
11026
11027 ------------------
11028 4.6.0 - 2019-02-18
11029 ------------------
11030
11031 This release changes some inconsistent behavior of :func:`~hypothesis.extra.numpy.arrays`
11032 from the Numpy extra when asked for an array of ``shape=()``.
11033 :func:`~hypothesis.extra.numpy.arrays` will now always return a Numpy
11034 :class:`~numpy:numpy.ndarray`, and the array will always be of the requested dtype.
11035
11036 Thanks to Ryan Turner for this change.
11037
11038 .. _v4.5.12:
11039
11040 -------------------
11041 4.5.12 - 2019-02-18
11042 -------------------
11043
11044 This release fixes a minor typo in an internal comment. There is no user-visible change.
11045
11046 .. _v4.5.11:
11047
11048 -------------------
11049 4.5.11 - 2019-02-15
11050 -------------------
11051
11052 This release fixes :issue:`1813`, a bug introduced in :ref:`3.59.1 <v3.59.1>`,
11053 which caused :py:meth:`~hypothesis.strategies.random_module` to no longer affect the body of the test:
11054 Although Hypothesis would claim to be seeding the random module in fact tests would always run with a seed of zero.
11055
11056 .. _v4.5.10:
11057
11058 -------------------
11059 4.5.10 - 2019-02-14
11060 -------------------
11061
11062 This patch fixes an off-by-one error in the maximum length of :func:`~hypothesis.strategies.emails`.
11063 Thanks to Krzysztof Jurewicz for :pull:`1812`.
11064
11065 .. _v4.5.9:
11066
11067 ------------------
11068 4.5.9 - 2019-02-14
11069 ------------------
11070
11071 This patch removes some unused code from the shrinker.
11072 There is no user-visible change.
11073
11074 .. _v4.5.8:
11075
11076 ------------------
11077 4.5.8 - 2019-02-12
11078 ------------------
11079
11080 This release fixes an internal ``IndexError`` in Hypothesis that could sometimes be triggered during shrinking.
11081
11082 .. _v4.5.7:
11083
11084 ------------------
11085 4.5.7 - 2019-02-11
11086 ------------------
11087
11088 This release modifies the shrinker to interleave different types of reduction operations,
11089 e.g. switching between deleting data and lowering scalar values rather than trying entirely deletions then entirely lowering.
11090
11091 This may slow things down somewhat in the typical case, but has the major advantage that many previously difficult to shrink examples should become much faster,
11092 because the shrinker will no longer tend to stall when trying some ineffective changes to the shrink target but will instead interleave it with other more effective operations.
11093
11094 .. _v4.5.6:
11095
11096 ------------------
11097 4.5.6 - 2019-02-11
11098 ------------------
11099
11100 This release makes a number of internal changes to the implementation of :func:`hypothesis.extra.lark.from_lark`.
11101 These are primarily intended as a refactoring, but you may see some minor improvements to performance when generating large strings,
11102 and possibly to shrink quality.
11103
11104 .. _v4.5.5:
11105
11106 ------------------
11107 4.5.5 - 2019-02-10
11108 ------------------
11109
11110 This patch prints an explanatory note when :issue:`1798` is triggered,
11111 because the error message from Numpy is too terse to locate the problem.
11112
11113 .. _v4.5.4:
11114
11115 ------------------
11116 4.5.4 - 2019-02-08
11117 ------------------
11118
11119 In Python 2, ``long`` integers are not allowed in the shape argument to
11120 :func:`~hypothesis.extra.numpy.arrays`. Thanks to Ryan Turner for fixing this.
11121
11122 .. _v4.5.3:
11123
11124 ------------------
11125 4.5.3 - 2019-02-08
11126 ------------------
11127
11128 This release makes a small internal refactoring to clarify how Hypothesis
11129 instructs tests to stop running when appropriate. There is no user-visible
11130 change.
11131
11132 .. _v4.5.2:
11133
11134 ------------------
11135 4.5.2 - 2019-02-06
11136 ------------------
11137
11138 This release standardises all of the shrinker's internal operations on running in a random order.
11139
11140 The main effect you will see from this that it should now be much less common for the shrinker to stall for a long time before making further progress.
11141 In some cases this will correspond to shrinking more slowly, but on average it should result in faster shrinking.
11142
11143 .. _v4.5.1:
11144
11145 ------------------
11146 4.5.1 - 2019-02-05
11147 ------------------
11148
11149 This patch updates some docstrings, but has no runtime changes.
11150
11151 .. _v4.5.0:
11152
11153 ------------------
11154 4.5.0 - 2019-02-03
11155 ------------------
11156
11157 This release adds ``exclude_min`` and ``exclude_max`` arguments to
11158 :func:`~hypothesis.strategies.floats`, so that you can easily generate values from
11159 :wikipedia:`open or half-open intervals <Interval_(mathematics)>`
11160 (:issue:`1622`).
11161
11162 .. _v4.4.6:
11163
11164 ------------------
11165 4.4.6 - 2019-02-03
11166 ------------------
11167
11168 This patch fixes a bug where :func:`~hypothesis.strategies.from_regex`
11169 could throw an internal error if the :obj:`python:re.IGNORECASE` flag
11170 was used (:issue:`1786`).
11171
11172 .. _v4.4.5:
11173
11174 ------------------
11175 4.4.5 - 2019-02-02
11176 ------------------
11177
11178 This release removes two shrink passes that Hypothesis runs late in the process.
11179 These were very expensive when the test function was slow and often didn't do anything useful.
11180
11181 Shrinking should get faster for most failing tests.
11182 If you see any regression in example quality as a result of this release, please let us know.
11183
11184 .. _v4.4.4:
11185
11186 ------------------
11187 4.4.4 - 2019-02-02
11188 ------------------
11189
11190 This release modifies the way that Hypothesis deletes data during shrinking.
11191 It will primarily be noticeable for very large examples, which should now shrink faster.
11192
11193 The shrinker is now also able to perform some deletions that it could not previously,
11194 but this is unlikely to be very noticeable.
11195
11196 .. _v4.4.3:
11197
11198 ------------------
11199 4.4.3 - 2019-01-25
11200 ------------------
11201
11202 This release fixes an open file leak that used to cause ``ResourceWarning``\ s.
11203
11204 .. _v4.4.2:
11205
11206 ------------------
11207 4.4.2 - 2019-01-24
11208 ------------------
11209
11210 This release changes Hypothesis's internal approach to caching the results of executing test cases.
11211 The result should be that it is now significantly less memory hungry, especially when shrinking large test cases.
11212
11213 Some tests may get slower or faster depending on whether the new or old caching strategy was well suited to them,
11214 but any change in speed in either direction should be minor.
11215
11216 .. _v4.4.1:
11217
11218 ------------------
11219 4.4.1 - 2019-01-24
11220 ------------------
11221
11222 This patch tightens up some of our internal heuristics to deal with shrinking floating point numbers,
11223 which will now run in fewer circumstances.
11224
11225 You are fairly unlikely to see much difference from this, but if you do you are likely to see shrinking become slightly faster and/or producing slightly worse results.
11226
11227 .. _v4.4.0:
11228
11229 ------------------
11230 4.4.0 - 2019-01-24
11231 ------------------
11232
11233 This release adds the :func:`~hypothesis.extra.django.from_form` function, which allows automatic testing against Django forms. (:issue:`35`)
11234
11235 Thanks to Paul Stiverson for this feature, which resolves our oldest open issue!
11236
11237 .. _v4.3.0:
11238
11239 ------------------
11240 4.3.0 - 2019-01-24
11241 ------------------
11242
11243 This release deprecates ``HealthCheck.hung_test`` and disables the
11244 associated runtime check for tests that ran for more than five minutes.
11245 Such a check is redundant now that we enforce the ``deadline`` and
11246 ``max_examples`` setting, which can be adjusted independently.
11247
11248 .. _v4.2.0:
11249
11250 ------------------
11251 4.2.0 - 2019-01-23
11252 ------------------
11253
11254 This release adds a new module, ``hypothesis.extra.lark``, which you
11255 can use to generate strings matching a context-free grammar.
11256
11257 In this initial version, only :pypi:`lark-parser` EBNF grammars are supported,
11258 by the new :func:`hypothesis.extra.lark.from_lark` function.
11259
11260 .. _v4.1.2:
11261
11262 ------------------
11263 4.1.2 - 2019-01-23
11264 ------------------
11265
11266 This patch fixes a very rare overflow bug (:issue:`1748`) which could raise an
11267 ``InvalidArgument`` error in :func:`~hypothesis.strategies.complex_numbers`
11268 even though the arguments were valid.
11269
11270 .. _v4.1.1:
11271
11272 ------------------
11273 4.1.1 - 2019-01-23
11274 ------------------
11275
11276 This release makes some improvements to internal code organisation and documentation and has no impact on behaviour.
11277
11278 .. _v4.1.0:
11279
11280 ------------------
11281 4.1.0 - 2019-01-22
11282 ------------------
11283
11284 This release adds :func:`~hypothesis.register_random`, which registers
11285 ``random.Random`` instances or compatible objects to be seeded and reset
11286 by Hypothesis to ensure that test cases are deterministic.
11287
11288 We still recommend explicitly passing a ``random.Random`` instance from
11289 :func:`~hypothesis.strategies.randoms` if possible, but registering a
11290 framework-global state for Hypothesis to manage is better than flaky tests!
11291
11292 .. _v4.0.2:
11293
11294 ------------------
11295 4.0.2 - 2019-01-22
11296 ------------------
11297
11298 This patch fixes :issue:`1387`, where bounded :func:`~hypothesis.strategies.integers`
11299 with a very large range would almost always generate very large numbers.
11300 Now, we usually use the same tuned distribution as unbounded
11301 :func:`~hypothesis.strategies.integers`.
11302
11303 .. _v4.0.1:
11304
11305 ------------------
11306 4.0.1 - 2019-01-16
11307 ------------------
11308
11309 This release randomizes the order in which the shrinker tries some of its initial normalization operations.
11310 You are unlikely to see much difference as a result unless your generated examples are very large.
11311 In this case you may see some performance improvements in shrinking.
11312
11313 .. _v4.0.0:
11314
11315 ------------------
11316 4.0.0 - 2019-01-14
11317 ------------------
11318
11319 Welcome to the next major version of Hypothesis!
11320
11321 There are no new features here, as we release those in minor versions.
11322 Instead, 4.0 is a chance for us to remove deprecated features (many already
11323 converted into no-ops), and turn a variety of warnings into errors.
11324
11325 If you were running on the last version of Hypothesis 3.x *without any
11326 Hypothesis deprecation warnings* (or using private APIs), this will be
11327 a very boring upgrade. **In fact, nothing will change for you at all.**
11328 Per :ref:`our deprecation policy <deprecation-policy>`, warnings added in
11329 the last six months (after 2018-07-05) have not been converted to errors.
11330
11331
11332 Removals
11333 ~~~~~~~~
11334 - ``hypothesis.extra.datetime`` has been removed, replaced by the core
11335 date and time strategies.
11336 - ``hypothesis.extra.fakefactory`` has been removed, replaced by general
11337 expansion of Hypothesis' strategies and the third-party ecosystem.
11338 - The SQLite example database backend has been removed.
11339
11340 Settings
11341 ~~~~~~~~
11342 - The :obj:`~hypothesis.settings.deadline` is now enforced by default, rather than just
11343 emitting a warning when the default (200 milliseconds per test case) deadline is exceeded.
11344 - The ``database_file`` setting has been removed; use :obj:`~hypothesis.settings.database`.
11345 - The ``perform_health_check`` setting has been removed; use
11346 :obj:`~hypothesis.settings.suppress_health_check`.
11347 - The ``max_shrinks`` setting has been removed; use :obj:`~hypothesis.settings.phases`
11348 to disable shrinking.
11349 - The ``min_satisfying_examples``, ``max_iterations``, ``strict``, ``timeout``, and
11350 ``use_coverage`` settings have been removed without user-configurable replacements.
11351
11352 Strategies
11353 ~~~~~~~~~~
11354 - The ``elements`` argument is now required for collection strategies.
11355 - The ``average_size`` argument was a no-op and has been removed.
11356 - Date and time strategies now only accept ``min_value`` and ``max_value`` for bounds.
11357 - :func:`~hypothesis.strategies.builds` now requires that the thing to build is
11358 passed as the first positional argument.
11359 - Alphabet validation for :func:`~hypothesis.strategies.text` raises errors, not warnings,
11360 as does category validation for :func:`~hypothesis.strategies.characters`.
11361 - The ``choices()`` strategy has been removed. Instead, you can use
11362 :func:`~hypothesis.strategies.data` with :func:`~hypothesis.strategies.sampled_from`,
11363 so ``choice(elements)`` becomes ``data.draw(sampled_from(elements))``.
11364 - The ``streaming()`` strategy has been removed. Instead, you can use
11365 :func:`~hypothesis.strategies.data` and replace iterating over the stream with
11366 ``data.draw()`` calls.
11367 - :func:`~hypothesis.strategies.sampled_from` and :func:`~hypothesis.strategies.permutations`
11368 raise errors instead of warnings if passed a collection that is not a sequence.
11369
11370 Miscellaneous
11371 ~~~~~~~~~~~~~
11372 - Applying :func:`@given <hypothesis.given>` to a test function multiple times
11373 was really inefficient, and now it's also an error.
11374 - Using the ``.example()`` method of a strategy (intended for interactive
11375 exploration) within another strategy or a test function always weakened
11376 data generation and broke shrinking, and now it's an error too.
11377 - The ``HYPOTHESIS_DATABASE_FILE`` environment variable is no longer
11378 supported, as the ``database_file`` setting has been removed.
11379 - The ``HYPOTHESIS_VERBOSITY_LEVEL`` environment variable is no longer
11380 supported. You can use the ``--hypothesis-verbosity`` pytest argument instead,
11381 or write your own setup code using the settings profile system to replace it.
11382 - Using :func:`@seed <hypothesis.seed>` or
11383 :obj:`derandomize=True <hypothesis.settings.derandomize>` now forces
11384 :obj:`database=None <hypothesis.settings.database>` to ensure results
11385 are in fact reproducible. If :obj:`~hypothesis.settings.database` is
11386 *not* ``None``, doing so also emits a ``HypothesisWarning``.
11387 - Unused exception types have been removed from ``hypothesis.errors``;
11388 namely ``AbnormalExit``, ``BadData``, ``BadTemplateDraw``,
11389 ``DefinitelyNoSuchExample``, ``Timeout``, and ``WrongFormat``.
11390
11391
11392 Hypothesis 3.x
11393 ==============
11394
11395 .. _v3.88.3:
11396
11397 -------------------
11398 3.88.3 - 2019-01-11
11399 -------------------
11400
11401 This changes the order that the shrinker tries certain operations in its "emergency" phase which runs late in the process.
11402 The new order should be better at avoiding long stalls where the shrinker is failing to make progress,
11403 which may be helpful if you have difficult to shrink test cases.
11404 However this will not be noticeable in the vast majority of use cases.
11405
11406 .. _v3.88.2:
11407
11408 -------------------
11409 3.88.2 - 2019-01-11
11410 -------------------
11411
11412 This is a pure refactoring release that extracts some logic from the core Hypothesis engine
11413 into its own class and file. It should have no user visible impact.
11414
11415 .. _v3.88.1:
11416
11417 -------------------
11418 3.88.1 - 2019-01-11
11419 -------------------
11420
11421 This patch fixes some markup in our documentation.
11422
11423 .. _v3.88.0:
11424
11425 -------------------
11426 3.88.0 - 2019-01-10
11427 -------------------
11428
11429 Introduces :func:`hypothesis.stateful.multiple`, which allows rules in rule
11430 based state machines to send multiple results at once to their target Bundle,
11431 or none at all.
11432
11433 .. _v3.87.0:
11434
11435 -------------------
11436 3.87.0 - 2019-01-10
11437 -------------------
11438
11439 This release contains a massive cleanup of the Hypothesis for Django extra:
11440
11441 - ``hypothesis.extra.django.models.models()`` is deprecated in favor of
11442 :func:`hypothesis.extra.django.from_model`.
11443 - ``hypothesis.extra.django.models.add_default_field_mapping()`` is deprecated
11444 in favor of :func:`hypothesis.extra.django.register_field_strategy`.
11445 - :func:`~hypothesis.extra.django.from_model` does not infer a strategy for
11446 nullable fields or fields with a default unless passed ``infer``, like
11447 :func:`~hypothesis.strategies.builds`.
11448 ``models.models()`` would usually but not always infer, and a special
11449 ``default_value`` marker object was required to disable inference.
11450
11451 .. _v3.86.9:
11452
11453 -------------------
11454 3.86.9 - 2019-01-09
11455 -------------------
11456
11457 This release improves some internal logic about when a test case in Hypothesis's internal representation could lead to a valid test case.
11458 In some circumstances this can lead to a significant speed up during shrinking.
11459 It may have some minor negative impact on the quality of the final result due to certain shrink passes now having access to less information about test cases in some circumstances, but this should rarely matter.
11460
11461 .. _v3.86.8:
11462
11463 -------------------
11464 3.86.8 - 2019-01-09
11465 -------------------
11466
11467 This release has no user visible changes but updates our URLs to use HTTPS.
11468
11469 .. _v3.86.7:
11470
11471 -------------------
11472 3.86.7 - 2019-01-08
11473 -------------------
11474
11475 Hypothesis can now automatically generate values for Django models with a
11476 `~django.db.models.URLField`, thanks to a new provisional strategy for URLs (:issue:`1388`).
11477
11478 .. _v3.86.6:
11479
11480 -------------------
11481 3.86.6 - 2019-01-07
11482 -------------------
11483
11484 This release is a pure refactoring that extracts some internal code into its own file.
11485 It should have no user visible effect.
11486
11487 .. _v3.86.5:
11488
11489 -------------------
11490 3.86.5 - 2019-01-06
11491 -------------------
11492
11493 This is a docs-only patch, which fixes some typos and removes a few hyperlinks
11494 for deprecated features.
11495
11496 .. _v3.86.4:
11497
11498 -------------------
11499 3.86.4 - 2019-01-04
11500 -------------------
11501
11502 This release changes the order in which the shrinker tries to delete data.
11503 For large and slow tests this may significantly improve the performance of shrinking.
11504
11505 .. _v3.86.3:
11506
11507 -------------------
11508 3.86.3 - 2019-01-04
11509 -------------------
11510
11511 This release fixes a bug where certain places Hypothesis internal errors could be
11512 raised during shrinking when a user exception occurred that suppressed an exception
11513 Hypothesis uses internally in its generation.
11514
11515 The two known ways to trigger this problem were:
11516
11517 * Errors raised in stateful tests' teardown function.
11518 * Errors raised in finally blocks that wrapped a call to ``data.draw``.
11519
11520 These cases will now be handled correctly.
11521
11522 .. _v3.86.2:
11523
11524 -------------------
11525 3.86.2 - 2019-01-04
11526 -------------------
11527
11528 This patch is a docs-only change to fix a broken hyperlink.
11529
11530 .. _v3.86.1:
11531
11532 -------------------
11533 3.86.1 - 2019-01-04
11534 -------------------
11535
11536 This patch fixes :issue:`1732`, where :func:`~hypothesis.strategies.integers`
11537 would always return ``long`` values on Python 2.
11538
11539 .. _v3.86.0:
11540
11541 -------------------
11542 3.86.0 - 2019-01-03
11543 -------------------
11544
11545 This release ensures that infinite numbers are never generated by
11546 :func:`~hypothesis.strategies.floats` with ``allow_infinity=False``,
11547 which could previously happen in some cases where one bound was also
11548 provided.
11549
11550 The trivially inconsistent ``min_value=inf, allow_infinity=False`` now
11551 raises an InvalidArgumentError, as does the inverse with ``max_value``.
11552 You can still use :func:`just(inf) <hypothesis.strategies.just>` to
11553 generate ``inf`` without violating other constraints.
11554
11555 .. _v3.85.3:
11556
11557 -------------------
11558 3.85.3 - 2019-01-02
11559 -------------------
11560
11561 Happy new year everyone!
11562 This release has no user visible changes but updates our copyright headers to include 2019.
11563
11564 .. _v3.85.2:
11565
11566 -------------------
11567 3.85.2 - 2018-12-31
11568 -------------------
11569
11570 This release makes a small change to the way the shrinker works.
11571 You may see some improvements to speed of shrinking on especially large and hard to shrink examples,
11572 but most users are unlikely to see much difference.
11573
11574 .. _v3.85.1:
11575
11576 -------------------
11577 3.85.1 - 2018-12-30
11578 -------------------
11579
11580 This patch fixes :issue:`1700`, where a line that contained a Unicode character
11581 before a lambda definition would cause an internal exception.
11582
11583 .. _v3.85.0:
11584
11585 -------------------
11586 3.85.0 - 2018-12-29
11587 -------------------
11588
11589 Introduces the :func:`hypothesis.stateful.consumes` function. When defining
11590 a rule in stateful testing, it can be used to mark bundles from which values
11591 should be consumed, i. e. removed after use in the rule. This has been
11592 proposed in :issue:`136`.
11593
11594 Thanks to Jochen Müller for this long-awaited feature.
11595
11596 .. _v3.84.6:
11597
11598 -------------------
11599 3.84.6 - 2018-12-28
11600 -------------------
11601
11602 This patch makes a small internal change to fix an issue in Hypothesis's
11603 own coverage tests (:issue:`1718`).
11604
11605 There is no user-visible change.
11606
11607 .. _v3.84.5:
11608
11609 -------------------
11610 3.84.5 - 2018-12-21
11611 -------------------
11612
11613 This patch refactors the ``hypothesis.strategies`` module, so that private
11614 names should no longer appear in tab-completion lists. We previously relied
11615 on ``__all__`` for this, but not all editors respect it.
11616
11617 .. _v3.84.4:
11618
11619 -------------------
11620 3.84.4 - 2018-12-21
11621 -------------------
11622
11623 This is a follow-up patch to ensure that the deprecation date is automatically
11624 recorded for any new deprecations. There is no user-visible effect.
11625
11626 .. _v3.84.3:
11627
11628 -------------------
11629 3.84.3 - 2018-12-20
11630 -------------------
11631
11632 This patch updates the Hypothesis pytest plugin to avoid a recently
11633 deprecated hook interface. There is no user-visible change.
11634
11635 .. _v3.84.2:
11636
11637 -------------------
11638 3.84.2 - 2018-12-19
11639 -------------------
11640
11641 This patch fixes the internals for :func:`~hypothesis.strategies.integers`
11642 with one bound. Values from this strategy now always shrink towards zero
11643 instead of towards the bound, and should shrink much more efficiently too.
11644 On Python 2, providing a bound incorrectly excluded ``long`` integers,
11645 which can now be generated.
11646
11647 .. _v3.84.1:
11648
11649 -------------------
11650 3.84.1 - 2018-12-18
11651 -------------------
11652
11653 This patch adds information about when features were deprecated, but this
11654 is only recorded internally and has no user-visible effect.
11655
11656 .. _v3.84.0:
11657
11658 -------------------
11659 3.84.0 - 2018-12-18
11660 -------------------
11661
11662 This release changes the stateful testing backend from
11663 ``find()`` to use :func:`@given <hypothesis.given>`
11664 (:issue:`1300`). This doesn't change how you create stateful tests,
11665 but does make them run more like other Hypothesis tests.
11666
11667 :func:`@reproduce_failure <hypothesis.reproduce_failure>` and
11668 :func:`@seed <hypothesis.seed>` now work for stateful tests.
11669
11670 Stateful tests now respect the :attr:`~hypothesis.settings.deadline`
11671 and :attr:`~hypothesis.settings.suppress_health_check` settings,
11672 though they are disabled by default. You can enable them by using
11673 :func:`@settings(...) <hypothesis.settings>` as a class decorator
11674 with whatever arguments you prefer.
11675
11676 .. _v3.83.2:
11677
11678 -------------------
11679 3.83.2 - 2018-12-17
11680 -------------------
11681
11682 Hypothesis has adopted :pypi:`black` as our code formatter (:issue:`1686`).
11683 There are no functional changes to the source, but it's prettier!
11684
11685 .. _v3.83.1:
11686
11687 -------------------
11688 3.83.1 - 2018-12-13
11689 -------------------
11690
11691 This patch increases the variety of examples generated by
11692 :func:`~hypothesis.strategies.from_type`.
11693
11694 .. _v3.83.0:
11695
11696 -------------------
11697 3.83.0 - 2018-12-12
11698 -------------------
11699
11700 Our pytest plugin now warns you when strategy functions have been collected
11701 as tests, which may happen when e.g. using the
11702 :func:`@composite <hypothesis.strategies.composite>` decorator when you
11703 should be using ``@given(st.data())`` for inline draws.
11704 Such functions *always* pass when treated as tests, because the lazy creation
11705 of strategies mean that the function body is never actually executed!
11706
11707 .. _v3.82.6:
11708
11709 -------------------
11710 3.82.6 - 2018-12-11
11711 -------------------
11712
11713 Hypothesis can now :ref:`show statistics <statistics>` when running
11714 under :pypi:`pytest-xdist`. Previously, statistics were only reported
11715 when all tests were run in a single process (:issue:`700`).
11716
11717 .. _v3.82.5:
11718
11719 -------------------
11720 3.82.5 - 2018-12-08
11721 -------------------
11722
11723 This patch fixes :issue:`1667`, where passing bounds of Numpy
11724 dtype ``int64`` to :func:`~hypothesis.strategies.integers` could
11725 cause errors on Python 3 due to internal rounding.
11726
11727 .. _v3.82.4:
11728
11729 -------------------
11730 3.82.4 - 2018-12-08
11731 -------------------
11732
11733 Hypothesis now seeds and resets the global state of
11734 :mod:`np.random <numpy:numpy.random>` for each
11735 test case, to ensure that tests are reproducible.
11736
11737 This matches and complements the existing handling of the
11738 :mod:`python:random` module - Numpy simply maintains an
11739 independent PRNG for performance reasons.
11740
11741 .. _v3.82.3:
11742
11743 -------------------
11744 3.82.3 - 2018-12-08
11745 -------------------
11746
11747 This is a no-op release to add the new ``Framework :: Hypothesis``
11748 `trove classifier <https://pypi.org/classifiers/>`_ to
11749 :pypi:`hypothesis` on PyPI.
11750
11751 You can `use it as a filter <https://pypi.org/search/?c=Framework+%3A%3A+Hypothesis>`_
11752 to find Hypothesis-related packages such as extensions as they add the tag
11753 over the coming weeks, or simply visit :doc:`our curated list <reference/strategies>`.
11754
11755 .. _v3.82.2:
11756
11757 -------------------
11758 3.82.2 - 2018-12-08
11759 -------------------
11760
11761 The :ref:`Hypothesis for Pandas extension <hypothesis-pandas>` is now
11762 listed in ``setup.py``, so you can ``pip install hypothesis[pandas]``.
11763 Thanks to jmshi for this contribution.
11764
11765 .. _v3.82.1:
11766
11767 -------------------
11768 3.82.1 - 2018-10-29
11769 -------------------
11770
11771 This patch fixes :func:`~hypothesis.strategies.from_type` on Python 2
11772 for classes where ``cls.__init__ is object.__init__``.
11773 Thanks to ccxcz for reporting :issue:`1656`.
11774
11775 .. _v3.82.0:
11776
11777 -------------------
11778 3.82.0 - 2018-10-29
11779 -------------------
11780
11781 The ``alphabet`` argument for :func:`~hypothesis.strategies.text` now
11782 uses its default value of ``characters(exclude_categories=('Cs',))``
11783 directly, instead of hiding that behind ``alphabet=None`` and replacing
11784 it within the function. Passing ``None`` is therefore deprecated.
11785
11786 .. _v3.81.0:
11787
11788 -------------------
11789 3.81.0 - 2018-10-27
11790 -------------------
11791
11792 ``GenericStateMachine`` and
11793 :class:`~hypothesis.stateful.RuleBasedStateMachine` now raise an explicit error
11794 when instances of :obj:`~hypothesis.settings` are assigned to the classes'
11795 settings attribute, which is a no-op (:issue:`1643`). Instead assign to
11796 ``SomeStateMachine.TestCase.settings``, or use ``@settings(...)`` as a class
11797 decorator to handle this automatically.
11798
11799 .. _v3.80.0:
11800
11801 -------------------
11802 3.80.0 - 2018-10-25
11803 -------------------
11804
11805 Since :ref:`version 3.68.0 <v3.68.0>`, :func:`~hypothesis.extra.numpy.arrays`
11806 checks that values drawn from the ``elements`` and ``fill`` strategies can be
11807 safely cast to the dtype of the array, and emits a warning otherwise.
11808
11809 This release expands the checks to cover overflow for finite ``complex64``
11810 elements and string truncation caused by too-long elements or trailing null
11811 characters (:issue:`1591`).
11812
11813 .. _v3.79.4:
11814
11815 -------------------
11816 3.79.4 - 2018-10-25
11817 -------------------
11818
11819 Tests using :func:`@given <hypothesis.given>` now shrink errors raised from
11820 :pypi:`pytest` helper functions, instead of reporting the first example found.
11821
11822 This was previously fixed in :ref:`version 3.56.0 <v3.56.0>`, but only for
11823 stateful testing.
11824
11825 .. _v3.79.3:
11826
11827 -------------------
11828 3.79.3 - 2018-10-23
11829 -------------------
11830
11831 Traceback elision is now disabled on Python 2, to avoid an import-time
11832 :class:`python:SyntaxError` under Python < 2.7.9 (Python: :bpo:`21591`,
11833 :ref:`Hypothesis 3.79.2 <v3.79.2>`: :issue:`1648`).
11834
11835 We encourage all users to `upgrade to Python 3 before the end of 2019
11836 <https://pythonclock.org/>`_.
11837
11838 .. _v3.79.2:
11839
11840 -------------------
11841 3.79.2 - 2018-10-23
11842 -------------------
11843
11844 This patch shortens tracebacks from Hypothesis, so you can see exactly
11845 happened in your code without having to skip over irrelevant details
11846 about our internals (:issue:`848`).
11847
11848 In the example test (see :pull:`1582`), this reduces tracebacks from
11849 nine frames to just three - and for a test with multiple errors, from
11850 seven frames per error to just one!
11851
11852 If you *do* want to see the internal details, you can disable frame
11853 elision by setting :obj:`~hypothesis.settings.verbosity` to ``debug``.
11854
11855 .. _v3.79.1:
11856
11857 -------------------
11858 3.79.1 - 2018-10-22
11859 -------------------
11860
11861 The abstract number classes :class:`~python:numbers.Number`,
11862 :class:`~python:numbers.Complex`, :class:`~python:numbers.Real`,
11863 :class:`~python:numbers.Rational`, and :class:`~python:numbers.Integral`
11864 are now supported by the :func:`~hypothesis.strategies.from_type`
11865 strategy. Previously, you would have to use
11866 :func:`~hypothesis.strategies.register_type_strategy` before they
11867 could be resolved (:issue:`1636`)
11868
11869 .. _v3.79.0:
11870
11871 -------------------
11872 3.79.0 - 2018-10-18
11873 -------------------
11874
11875 This release adds a CLI flag for verbosity ``--hypothesis-verbosity`` to
11876 the Hypothesis pytest plugin, applied after loading the profile specified by
11877 ``--hypothesis-profile``. Valid options are the names of verbosity settings,
11878 quiet, normal, verbose or debug.
11879
11880 Thanks to Bex Dunn for writing this patch at the PyCon Australia
11881 sprints!
11882
11883 The pytest header now correctly reports the current profile if
11884 ``--hypothesis-profile`` has been used.
11885
11886 Thanks to Mathieu Paturel for the contribution at the Canberra Python
11887 Hacktoberfest.
11888
11889 .. _v3.78.0:
11890
11891 -------------------
11892 3.78.0 - 2018-10-16
11893 -------------------
11894
11895 This release has deprecated the generation of integers, floats and fractions
11896 when the conversion of the upper and/ or lower bound is not 100% exact, e.g.
11897 when an integer gets passed a bound that is not a whole number. (:issue:`1625`)
11898
11899 Thanks to Felix Grünewald for this patch during Hacktoberfest 2018.
11900
11901 .. _v3.77.0:
11902
11903 -------------------
11904 3.77.0 - 2018-10-16
11905 -------------------
11906
11907 This minor release adds functionality to :obj:`~hypothesis.settings` allowing
11908 it to be used as a decorator on :obj:`~hypothesis.stateful.RuleBasedStateMachine`
11909 and ``GenericStateMachine``.
11910
11911 Thanks to Tyler Nickerson for this feature in #hacktoberfest!
11912
11913 .. _v3.76.1:
11914
11915 -------------------
11916 3.76.1 - 2018-10-16
11917 -------------------
11918
11919 This patch fixes some warnings added by recent releases of
11920 :pypi:`pydocstyle` and :pypi:`mypy`.
11921
11922 .. _v3.76.0:
11923
11924 -------------------
11925 3.76.0 - 2018-10-11
11926 -------------------
11927
11928 This release deprecates using floats for ``min_size`` and ``max_size``.
11929
11930 The type hint for ``average_size`` arguments has been changed from
11931 ``Optional[int]`` to None, because non-None values are always ignored and
11932 deprecated.
11933
11934 .. _v3.75.4:
11935
11936 -------------------
11937 3.75.4 - 2018-10-10
11938 -------------------
11939
11940 This patch adds more internal comments to the core engine's sequence-length
11941 shrinker. There should be no user-visible change.
11942
11943 .. _v3.75.3:
11944
11945 -------------------
11946 3.75.3 - 2018-10-09
11947 -------------------
11948
11949 This patch adds additional comments to some of the core engine's internal
11950 data structures. There is no user-visible change.
11951
11952 .. _v3.75.2:
11953
11954 -------------------
11955 3.75.2 - 2018-10-09
11956 -------------------
11957
11958 This patch avoids caching a trivial case, fixing :issue:`493`.
11959
11960 .. _v3.75.1:
11961
11962 -------------------
11963 3.75.1 - 2018-10-09
11964 -------------------
11965
11966 This patch fixes a broken link in a docstring.
11967 Thanks to Benjamin Lee for this contribution!
11968
11969 .. _v3.75.0:
11970
11971 -------------------
11972 3.75.0 - 2018-10-08
11973 -------------------
11974
11975 This release deprecates the use of ``min_size=None``, setting the default
11976 ``min_size`` to 0 (:issue:`1618`).
11977
11978 .. _v3.74.3:
11979
11980 -------------------
11981 3.74.3 - 2018-10-08
11982 -------------------
11983
11984 This patch makes some small internal changes to comply with a new lint setting
11985 in the build. There should be no user-visible change.
11986
11987 .. _v3.74.2:
11988
11989 -------------------
11990 3.74.2 - 2018-10-03
11991 -------------------
11992
11993 This patch fixes :issue:`1153`, where time spent reifying a strategy was
11994 also counted in the time spent generating the first example. Strategies
11995 are now fully constructed and validated before the timer is started.
11996
11997 .. _v3.74.1:
11998
11999 -------------------
12000 3.74.1 - 2018-10-03
12001 -------------------
12002
12003 This patch fixes some broken formatting and links in the documentation.
12004
12005 .. _v3.74.0:
12006
12007 -------------------
12008 3.74.0 - 2018-10-01
12009 -------------------
12010
12011 This release checks that the value of the
12012 :attr:`~hypothesis.settings.print_blob` setting is a
12013 ``PrintSettings`` instance.
12014
12015 Being able to specify a boolean value was not intended, and is now deprecated.
12016 In addition, specifying ``True`` will now cause the blob to always be printed,
12017 instead of causing it to be suppressed.
12018
12019 Specifying any value that is not a ``PrintSettings``
12020 or a boolean is now an error.
12021
12022 .. _v3.73.5:
12023
12024 -------------------
12025 3.73.5 - 2018-10-01
12026 -------------------
12027
12028 Changes the documentation for ``hypothesis.strategies.datetimes``, ``hypothesis.strategies.dates``, ``hypothesis.strategies.times`` to use the new parameter names ``min_value`` and ``max_value`` instead of the deprecated names
12029
12030 .. _v3.73.4:
12031
12032 -------------------
12033 3.73.4 - 2018-09-30
12034 -------------------
12035
12036 This patch ensures that Hypothesis deprecation warnings display the code
12037 that emitted them when you're not running in ``-Werror`` mode (:issue:`652`).
12038
12039 .. _v3.73.3:
12040
12041 -------------------
12042 3.73.3 - 2018-09-27
12043 -------------------
12044
12045 Tracebacks involving :func:`@composite <hypothesis.strategies.composite>`
12046 are now slightly shorter due to some internal refactoring.
12047
12048 .. _v3.73.2:
12049
12050 -------------------
12051 3.73.2 - 2018-09-26
12052 -------------------
12053
12054 This patch fixes errors in the internal comments for one of the shrinker
12055 passes. There is no user-visible change.
12056
12057 .. _v3.73.1:
12058
12059 -------------------
12060 3.73.1 - 2018-09-25
12061 -------------------
12062
12063 This patch substantially improves the distribution of data generated
12064 with :func:`~hypothesis.strategies.recursive`, and fixes a rare internal
12065 error (:issue:`1502`).
12066
12067 .. _v3.73.0:
12068
12069 -------------------
12070 3.73.0 - 2018-09-24
12071 -------------------
12072
12073 This release adds the :func:`~hypothesis.extra.dpcontracts.fulfill` function,
12074 which is designed for testing code that uses :pypi:`dpcontracts` 0.4 or later
12075 for input validation. This provides some syntactic sugar around use of
12076 :func:`~hypothesis.assume`, to automatically filter out and retry calls that
12077 cause a precondition check to fail (:issue:`1474`).
12078
12079 .. _v3.72.0:
12080
12081 -------------------
12082 3.72.0 - 2018-09-24
12083 -------------------
12084
12085 This release makes setting attributes of the :class:`hypothesis.settings`
12086 class an explicit error. This has never had any effect, but could mislead
12087 users who confused it with the current settings *instance*
12088 ``hypothesis.settings.default`` (which is also immutable). You can change
12089 the global settings with |settings.register_profile|.
12090
12091 .. _v3.71.11:
12092
12093 --------------------
12094 3.71.11 - 2018-09-24
12095 --------------------
12096
12097 This patch factors out some common code in the shrinker for iterating
12098 over pairs of data blocks. There should be no user-visible change.
12099
12100 .. _v3.71.10:
12101
12102 --------------------
12103 3.71.10 - 2018-09-18
12104 --------------------
12105
12106 This patch allows :func:`~hypothesis.strategies.from_type` to handle the
12107 empty tuple type, :obj:`typing.Tuple[()] <python:typing.Tuple>`.
12108
12109 .. _v3.71.9:
12110
12111 -------------------
12112 3.71.9 - 2018-09-17
12113 -------------------
12114
12115 This patch updates some internal comments for :pypi:`mypy`.
12116 There is no user-visible effect, even for Mypy users.
12117
12118 .. _v3.71.8:
12119
12120 -------------------
12121 3.71.8 - 2018-09-17
12122 -------------------
12123
12124 This patch fixes a rare bug that would cause a particular shrinker pass to
12125 raise an IndexError, if a shrink improvement changed the underlying data
12126 in an unexpected way.
12127
12128 .. _v3.71.7:
12129
12130 -------------------
12131 3.71.7 - 2018-09-17
12132 -------------------
12133
12134 This release fixes the broken cross-references in our docs,
12135 and adds a CI check so we don't add new ones.
12136
12137 .. _v3.71.6:
12138
12139 -------------------
12140 3.71.6 - 2018-09-16
12141 -------------------
12142
12143 This patch fixes two bugs (:issue:`944` and :issue:`1521`), where messages
12144 about :func:`@seed <hypothesis.seed>` did not check the current verbosity
12145 setting, and the wrong settings were active while executing
12146 explicit examples from |@example|.
12147
12148 .. _v3.71.5:
12149
12150 -------------------
12151 3.71.5 - 2018-09-15
12152 -------------------
12153
12154 This patch fixes a ``DeprecationWarning`` added in Python 3.8 (:issue:`1576`).
12155
12156 Thanks to tirkarthi for this contribution!
12157
12158 .. _v3.71.4:
12159
12160 -------------------
12161 3.71.4 - 2018-09-14
12162 -------------------
12163
12164 This is a no-op release, which implements automatic DOI minting and code
12165 archival of Hypothesis via `Zenodo <https://zenodo.org/>`_. Thanks to
12166 CERN and the EU *Horizon 2020* programme for providing this service!
12167
12168 Check our :gh-file:`CITATION.cff` file for details, or head right on over to
12169 `doi.org/10.5281/zenodo.1412597 <https://doi.org/10.5281/zenodo.1412597>`_
12170
12171 .. _v3.71.3:
12172
12173 -------------------
12174 3.71.3 - 2018-09-10
12175 -------------------
12176
12177 This release adds the test name to some deprecation warnings,
12178 for easier debugging.
12179
12180 Thanks to Sanyam Khurana for the patch!
12181
12182 .. _v3.71.2:
12183
12184 -------------------
12185 3.71.2 - 2018-09-10
12186 -------------------
12187
12188 This release makes Hypothesis's memory usage substantially smaller for tests with many
12189 examples, by bounding the number of past examples it keeps around.
12190
12191 You will not see much difference unless you are running tests with :obj:`~hypothesis.settings.max_examples`
12192 set to well over ``1000``, but if you do have such tests then you should see memory usage mostly plateau
12193 where previously it would have grown linearly with time.
12194
12195 .. _v3.71.1:
12196
12197 -------------------
12198 3.71.1 - 2018-09-09
12199 -------------------
12200
12201 This patch adds internal comments to some tree traversals in the core engine.
12202 There is no user-visible change.
12203
12204 .. _v3.71.0:
12205
12206 -------------------
12207 3.71.0 - 2018-09-08
12208 -------------------
12209
12210 This release deprecates the coverage-guided testing functionality,
12211 as it has proven brittle and does not really pull its weight.
12212
12213 We intend to replace it with something more useful in the future,
12214 but the feature in its current form does not seem to be worth the cost of using,
12215 and whatever replaces it will likely look very different.
12216
12217 .. _v3.70.4:
12218
12219 -------------------
12220 3.70.4 - 2018-09-08
12221 -------------------
12222
12223 This patch changes the behaviour of :func:`~hypothesis.reproduce_failure`
12224 so that blobs are only printed in quiet mode when the
12225 :obj:`~hypothesis.settings.print_blob` setting is set to ``ALWAYS``.
12226
12227 Thanks to Cameron McGill for writing this patch at the PyCon Australia sprints!
12228
12229 .. _v3.70.3:
12230
12231 -------------------
12232 3.70.3 - 2018-09-03
12233 -------------------
12234
12235 This patch removes some unnecessary code from the internals.
12236 There is no user-visible change.
12237
12238 .. _v3.70.2:
12239
12240 -------------------
12241 3.70.2 - 2018-09-03
12242 -------------------
12243
12244 This patch fixes an internal bug where a corrupted argument to
12245 :func:`@reproduce_failure <hypothesis.reproduce_failure>` could raise
12246 the wrong type of error. Thanks again to Paweł T. Jochym, who maintains
12247 Hypothesis on `conda-forge <https://conda-forge.org/>`_ and consistently
12248 provides excellent bug reports including :issue:`1558`.
12249
12250 .. _v3.70.1:
12251
12252 -------------------
12253 3.70.1 - 2018-09-03
12254 -------------------
12255
12256 This patch updates hypothesis to report its version and settings when run with
12257 pytest. (:issue:`1223`).
12258
12259 Thanks to Jack Massey for this feature.
12260
12261 .. _v3.70.0:
12262
12263 -------------------
12264 3.70.0 - 2018-09-01
12265 -------------------
12266
12267 This release adds a ``fullmatch`` argument to
12268 :func:`~hypothesis.strategies.from_regex`. When ``fullmatch=True``, the
12269 whole example will match the regex pattern as for :func:`python:re.fullmatch`.
12270
12271 Thanks to Jakub Nabaglo for writing this patch at the PyCon Australia sprints!
12272
12273 .. _v3.69.12:
12274
12275 --------------------
12276 3.69.12 - 2018-08-30
12277 --------------------
12278
12279 This release reverts the changes to logging handling in 3.69.11,
12280 which broke test that use the :pypi:`pytest` ``caplog`` fixture
12281 internally because all logging was disabled (:issue:`1546`).
12282
12283 .. _v3.69.11:
12284
12285 --------------------
12286 3.69.11 - 2018-08-29
12287 --------------------
12288
12289 This patch will hide all logging messages produced by test cases before the
12290 final, minimal, failing test case (:issue:`356`).
12291
12292 Thanks to Gary Donovan for writing this patch at the PyCon Australia sprints!
12293
12294 .. _v3.69.10:
12295
12296 --------------------
12297 3.69.10 - 2018-08-29
12298 --------------------
12299
12300 This patch fixes a bug that prevents coverage from reporting unexecuted
12301 Python files (:issue:`1085`).
12302
12303 Thanks to Gary Donovan for writing this patch at the PyCon Australia sprints!
12304
12305 .. _v3.69.9:
12306
12307 -------------------
12308 3.69.9 - 2018-08-28
12309 -------------------
12310
12311 This patch improves the packaging of the Python package by adding
12312 ``LICENSE.txt`` to the sdist (:issue:`1311`), clarifying the minimum
12313 supported versions of :pypi:`pytz` and :pypi:`dateutil <python-dateutil>`
12314 (:issue:`1383`), and adds keywords to the metadata (:issue:`1520`).
12315
12316 Thanks to Graham Williamson for writing this patch at the PyCon
12317 Australia sprints!
12318
12319 .. _v3.69.8:
12320
12321 -------------------
12322 3.69.8 - 2018-08-28
12323 -------------------
12324
12325 This is an internal change which replaces pickle with json to prevent possible
12326 security issues.
12327
12328 Thanks to Vidya Rani D G for writing this patch at the PyCon Australia sprints!
12329
12330 .. _v3.69.7:
12331
12332 -------------------
12333 3.69.7 - 2018-08-28
12334 -------------------
12335
12336 This patch ensures that :func:`~hypothesis.note` prints the note for every
12337 test case when the :obj:`~hypothesis.settings.verbosity` setting is
12338 ``Verbosity.verbose``. At normal verbosity it only prints from the final
12339 test case.
12340
12341 Thanks to Tom McDermott for writing this patch at
12342 the PyCon Australia sprints!
12343
12344 .. _v3.69.6:
12345
12346 -------------------
12347 3.69.6 - 2018-08-27
12348 -------------------
12349
12350 This patch improves the testing of some internal caching. It should have
12351 no user-visible effect.
12352
12353 .. _v3.69.5:
12354
12355 -------------------
12356 3.69.5 - 2018-08-27
12357 -------------------
12358
12359 This change performs a small rename and refactoring in the core engine.
12360 There is no user-visible change.
12361
12362 .. _v3.69.4:
12363
12364 -------------------
12365 3.69.4 - 2018-08-27
12366 -------------------
12367
12368 This change improves the core engine's ability to avoid unnecessary work,
12369 by consulting its cache of previously-tried inputs in more cases.
12370
12371 .. _v3.69.3:
12372
12373 -------------------
12374 3.69.3 - 2018-08-27
12375 -------------------
12376
12377 This patch handles passing an empty :class:`python:enum.Enum` to
12378 :func:`~hypothesis.strategies.from_type` by returning
12379 :func:`~hypothesis.strategies.nothing`, instead of raising an
12380 internal :class:`python:AssertionError`.
12381
12382 Thanks to Paul Amazona for writing this patch at the
12383 PyCon Australia sprints!
12384
12385 .. _v3.69.2:
12386
12387 -------------------
12388 3.69.2 - 2018-08-23
12389 -------------------
12390
12391 This patch fixes a small mistake in an internal comment.
12392 There is no user-visible change.
12393
12394 .. _v3.69.1:
12395
12396 -------------------
12397 3.69.1 - 2018-08-21
12398 -------------------
12399
12400 This change fixes a small bug in how the core engine consults its cache
12401 of previously-tried inputs. There is unlikely to be any user-visible change.
12402
12403 .. _v3.69.0:
12404
12405 -------------------
12406 3.69.0 - 2018-08-20
12407 -------------------
12408
12409 This release improves argument validation for stateful testing.
12410
12411 - If the target or targets of a :func:`~hypothesis.stateful.rule` are invalid,
12412 we now raise a useful validation error rather than an internal exception.
12413 - Passing both the ``target`` and ``targets`` arguments is deprecated -
12414 append the ``target`` bundle to the ``targets`` tuple of bundles instead.
12415 - Passing the name of a Bundle rather than the Bundle itself is also deprecated.
12416
12417 .. _v3.68.3:
12418
12419 -------------------
12420 3.68.3 - 2018-08-20
12421 -------------------
12422
12423 This is a docs-only patch, fixing some typos and formatting issues.
12424
12425 .. _v3.68.2:
12426
12427 -------------------
12428 3.68.2 - 2018-08-19
12429 -------------------
12430
12431 This change fixes a small bug in how the core engine caches the results of
12432 previously-tried inputs. The effect is unlikely to be noticeable, but it might
12433 avoid unnecessary work in some cases.
12434
12435 .. _v3.68.1:
12436
12437 -------------------
12438 3.68.1 - 2018-08-18
12439 -------------------
12440
12441 This patch documents the :func:`~hypothesis.extra.numpy.from_dtype` function,
12442 which infers a strategy for :class:`numpy:numpy.dtype`\ s. This is used in
12443 :func:`~hypothesis.extra.numpy.arrays`, but can also be used directly when
12444 creating e.g. Pandas objects.
12445
12446 .. _v3.68.0:
12447
12448 -------------------
12449 3.68.0 - 2018-08-15
12450 -------------------
12451
12452 :func:`~hypothesis.extra.numpy.arrays` now checks that integer and float
12453 values drawn from ``elements`` and ``fill`` strategies can be safely cast
12454 to the dtype of the array, and emits a warning otherwise (:issue:`1385`).
12455
12456 Elements in the resulting array could previously violate constraints on
12457 the elements strategy due to floating-point overflow or truncation of
12458 integers to fit smaller types.
12459
12460 .. _v3.67.1:
12461
12462 -------------------
12463 3.67.1 - 2018-08-14
12464 -------------------
12465
12466 This release contains a tiny refactoring of the internals.
12467 There is no user-visible change.
12468
12469 .. _v3.67.0:
12470
12471 -------------------
12472 3.67.0 - 2018-08-10
12473 -------------------
12474
12475 This release adds a ``width`` argument to :func:`~hypothesis.strategies.floats`,
12476 to generate lower-precision floating point numbers for e.g. Numpy arrays.
12477
12478 The generated examples are always instances of Python's native ``float``
12479 type, which is 64bit, but passing ``width=32`` will ensure that all values
12480 can be exactly represented as 32bit floats. This can be useful to avoid
12481 overflow (to +/- infinity), and for efficiency of generation and shrinking.
12482
12483 Half-precision floats (``width=16``) are also supported, but require Numpy
12484 if you are running Python 3.5 or earlier.
12485
12486 .. _v3.66.33:
12487
12488 --------------------
12489 3.66.33 - 2018-08-10
12490 --------------------
12491
12492 This release fixes a bug in :func:`~hypothesis.strategies.floats`, where
12493 setting ``allow_infinity=False`` and exactly one of ``min_value`` and
12494 ``max_value`` would allow infinite values to be generated.
12495
12496 .. _v3.66.32:
12497
12498 --------------------
12499 3.66.32 - 2018-08-09
12500 --------------------
12501
12502 This release adds type hints to the :obj:`@example() <hypothesis.example>` and
12503 :func:`~hypothesis.seed` decorators, and fixes the type hint on
12504 :func:`~hypothesis.strategies.register_type_strategy`. The second argument to
12505 :func:`~hypothesis.strategies.register_type_strategy` must either be a
12506 ``SearchStrategy``, or a callable which takes a ``type`` and returns a
12507 ``SearchStrategy``.
12508
12509 .. _v3.66.31:
12510
12511 --------------------
12512 3.66.31 - 2018-08-08
12513 --------------------
12514
12515 Another set of changes designed to improve the performance of shrinking on
12516 large examples. In particular the shrinker should now spend considerably less
12517 time running useless shrinks.
12518
12519 .. _v3.66.30:
12520
12521 --------------------
12522 3.66.30 - 2018-08-06
12523 --------------------
12524
12525 "Bug fixes and performance improvements".
12526
12527 This release is a fairly major overhaul of the shrinker designed to improve
12528 its behaviour on large examples, especially around stateful testing. You
12529 should hopefully see shrinking become much faster, with little to no quality
12530 degradation (in some cases quality may even improve).
12531
12532 .. _v3.66.29:
12533
12534 --------------------
12535 3.66.29 - 2018-08-05
12536 --------------------
12537
12538 This release fixes two very minor bugs in the core engine:
12539
12540 * it fixes a corner case that was missing in :ref:`3.66.28 <v3.66.28>`, which
12541 should cause shrinking to work slightly better.
12542 * it fixes some logic for how shrinking interacts with the database that was
12543 causing Hypothesis to be insufficiently aggressive about clearing out old
12544 keys.
12545
12546 .. _v3.66.28:
12547
12548 --------------------
12549 3.66.28 - 2018-08-05
12550 --------------------
12551
12552 This release improves how Hypothesis handles reducing the size of integers'
12553 representation. This change should mostly be invisible as it's purely about
12554 the underlying representation and not the generated value, but it may result
12555 in some improvements to shrink performance.
12556
12557 .. _v3.66.27:
12558
12559 --------------------
12560 3.66.27 - 2018-08-05
12561 --------------------
12562
12563 This release changes the order in which Hypothesis chooses parts of the test case
12564 to shrink. For typical usage this should be a significant performance improvement on
12565 large examples. It is unlikely to have a major impact on example quality, but where
12566 it does change the result it should usually be an improvement.
12567
12568 .. _v3.66.26:
12569
12570 --------------------
12571 3.66.26 - 2018-08-05
12572 --------------------
12573
12574 This release improves the debugging information that the shrinker emits about
12575 the operations it performs, giving better summary statistics about which
12576 passes resulted in test executions and whether they were successful.
12577
12578 .. _v3.66.25:
12579
12580 --------------------
12581 3.66.25 - 2018-08-05
12582 --------------------
12583
12584 This release fixes several bugs that were introduced to the shrinker in
12585 :ref:`3.66.24 <v3.66.24>` which would have caused it to behave significantly
12586 less well than advertised. With any luck you should *actually* see the promised
12587 benefits now.
12588
12589 .. _v3.66.24:
12590
12591 --------------------
12592 3.66.24 - 2018-08-03
12593 --------------------
12594
12595 This release changes how Hypothesis deletes data when shrinking in order to
12596 better handle deletion of large numbers of contiguous sequences. Most tests
12597 should see little change, but this will hopefully provide a significant
12598 speed up for :ref:`stateful testing <stateful>`.
12599
12600 .. _v3.66.23:
12601
12602 --------------------
12603 3.66.23 - 2018-08-02
12604 --------------------
12605
12606 This release makes some internal changes to enable further improvements to the
12607 shrinker. You may see some changes in the final shrunk examples, but they are
12608 unlikely to be significant.
12609
12610 .. _v3.66.22:
12611
12612 --------------------
12613 3.66.22 - 2018-08-01
12614 --------------------
12615
12616 This release adds some more internal caching to the shrinker. This should cause
12617 a significant speed up for shrinking, especially for stateful testing and
12618 large example sizes.
12619
12620 .. _v3.66.21:
12621
12622 --------------------
12623 3.66.21 - 2018-08-01
12624 --------------------
12625
12626 This patch is for downstream packagers - our tests now pass under
12627 :pypi:`pytest` 3.7.0 (released 2018-07-30). There are no changes
12628 to the source of Hypothesis itself.
12629
12630 .. _v3.66.20:
12631
12632 --------------------
12633 3.66.20 - 2018-08-01
12634 --------------------
12635
12636 This release removes some functionality from the shrinker that was taking a
12637 considerable amount of time and does not appear to be useful any more due to
12638 a number of quality improvements in the shrinker.
12639
12640 You may see some degradation in shrink quality as a result of this, but mostly
12641 shrinking should just get much faster.
12642
12643 .. _v3.66.19:
12644
12645 --------------------
12646 3.66.19 - 2018-08-01
12647 --------------------
12648
12649 This release slightly changes the format of some debugging information emitted
12650 during shrinking, and refactors some of the internal interfaces around that.
12651
12652 .. _v3.66.18:
12653
12654 --------------------
12655 3.66.18 - 2018-07-31
12656 --------------------
12657
12658 This release is a very small internal refactoring which should have no user
12659 visible impact.
12660
12661 .. _v3.66.17:
12662
12663 --------------------
12664 3.66.17 - 2018-07-31
12665 --------------------
12666
12667 This release fixes a bug that could cause an ``IndexError`` to be raised from
12668 inside Hypothesis during shrinking. It is likely that it was impossible to
12669 trigger this bug in practice - it was only made visible by some currently
12670 unreleased work.
12671
12672 .. _v3.66.16:
12673
12674 --------------------
12675 3.66.16 - 2018-07-31
12676 --------------------
12677
12678 This release is a very small internal refactoring which should have no user
12679 visible impact.
12680
12681 .. _v3.66.15:
12682
12683 --------------------
12684 3.66.15 - 2018-07-31
12685 --------------------
12686
12687 This release makes Hypothesis's shrinking faster by removing some redundant
12688 work that it does when minimizing values in its internal representation.
12689
12690 .. _v3.66.14:
12691
12692 --------------------
12693 3.66.14 - 2018-07-30
12694 --------------------
12695
12696 This release expands the deprecation of timeout from :ref:`3.16.0 <v3.16.0>` to
12697 also emit the deprecation warning in ``find`` or :ref:`stateful testing <stateful>`.
12698
12699 .. _v3.66.13:
12700
12701 --------------------
12702 3.66.13 - 2018-07-30
12703 --------------------
12704
12705 This release adds an additional shrink pass that is able to reduce the size of
12706 examples in some cases where the transformation is non-obvious. In particular
12707 this will improve the quality of some examples which would have regressed in
12708 :ref:`3.66.12 <v3.66.12>`.
12709
12710 .. _v3.66.12:
12711
12712 --------------------
12713 3.66.12 - 2018-07-28
12714 --------------------
12715
12716 This release changes how we group data together for shrinking. It should result
12717 in improved shrinker performance, especially in stateful testing.
12718
12719 .. _v3.66.11:
12720
12721 --------------------
12722 3.66.11 - 2018-07-28
12723 --------------------
12724
12725 This patch modifies how which rule to run is selected during
12726 :ref:`rule based stateful testing <stateful>`. This should result in a slight
12727 performance increase during generation and a significant performance and
12728 quality improvement when shrinking.
12729
12730 As a result of this change, some state machines which would previously have
12731 thrown an ``InvalidDefinition`` are no longer detected as invalid.
12732
12733 .. _v3.66.10:
12734
12735 --------------------
12736 3.66.10 - 2018-07-28
12737 --------------------
12738
12739 This release weakens some minor functionality in the shrinker that had only
12740 modest benefit and made its behaviour much harder to reason about.
12741
12742 This is unlikely to have much user visible effect, but it is possible that in
12743 some cases shrinking may get slightly slower. It is primarily to make it easier
12744 to work on the shrinker and pave the way for future work.
12745
12746 .. _v3.66.9:
12747
12748 -------------------
12749 3.66.9 - 2018-07-26
12750 -------------------
12751
12752 This release improves the information that Hypothesis emits about its shrinking
12753 when :obj:`~hypothesis.settings.verbosity` is set to debug.
12754
12755 .. _v3.66.8:
12756
12757 -------------------
12758 3.66.8 - 2018-07-24
12759 -------------------
12760
12761 This patch includes some minor fixes in the documentation, and updates
12762 the minimum version of :pypi:`pytest` to 3.0 (released August 2016).
12763
12764 .. _v3.66.7:
12765
12766 -------------------
12767 3.66.7 - 2018-07-24
12768 -------------------
12769
12770 This release fixes a bug where difficult to shrink tests could sometimes
12771 trigger an internal assertion error inside the shrinker.
12772
12773 .. _v3.66.6:
12774
12775 -------------------
12776 3.66.6 - 2018-07-23
12777 -------------------
12778
12779 This patch ensures that Hypothesis fully supports Python 3.7, by
12780 upgrading :func:`~hypothesis.strategies.from_type` (:issue:`1264`)
12781 and fixing some minor issues in our test suite (:issue:`1148`).
12782
12783 .. _v3.66.5:
12784
12785 -------------------
12786 3.66.5 - 2018-07-22
12787 -------------------
12788
12789 This patch fixes the online docs for various extras, by ensuring that
12790 their dependencies are installed on readthedocs.io (:issue:`1326`).
12791
12792 .. _v3.66.4:
12793
12794 -------------------
12795 3.66.4 - 2018-07-20
12796 -------------------
12797
12798 This release improves the shrinker's ability to reorder examples.
12799
12800 For example, consider the following test:
12801
12802 .. code-block:: python
12803
12804 import hypothesis.strategies as st
12805 from hypothesis import given
12806
12807 @given(st.text(), st.text())
12808 def test_non_equal(x, y):
12809 assert x != y
12810
12811 Previously this could have failed with either of ``x="", y="0"`` or
12812 ``x="0", y=""``. Now it should always fail with ``x="", y="0"``.
12813
12814 This will allow the shrinker to produce more consistent results, especially in
12815 cases where test cases contain some ordered collection whose actual order does
12816 not matter.
12817
12818 .. _v3.66.3:
12819
12820 -------------------
12821 3.66.3 - 2018-07-20
12822 -------------------
12823
12824 This patch fixes inference in the :func:`~hypothesis.strategies.builds`
12825 strategy with subtypes of :obj:`python:typing.NamedTuple`, where the
12826 ``__init__`` method is not useful for introspection. We now use the
12827 field types instead - thanks to James Uther for identifying this bug.
12828
12829 .. _v3.66.2:
12830
12831 -------------------
12832 3.66.2 - 2018-07-19
12833 -------------------
12834
12835 This release improves the shrinker's ability to handle situations where there
12836 is an additive constraint between two values.
12837
12838 For example, consider the following test:
12839
12840
12841 .. code-block:: python
12842
12843 import hypothesis.strategies as st
12844 from hypothesis import given
12845
12846 @given(st.integers(), st.integers())
12847 def test_does_not_exceed_100(m, n):
12848 assert m + n < 100
12849
12850 Previously this could have failed with almost any pair ``(m, n)`` with
12851 ``0 <= m <= n`` and ``m + n == 100``. Now it should almost always fail with
12852 ``m=0, n=100``.
12853
12854 This is a relatively niche specialisation, but can be useful in situations
12855 where e.g. a bug is triggered by an integer overflow.
12856
12857 .. _v3.66.1:
12858
12859 -------------------
12860 3.66.1 - 2018-07-09
12861 -------------------
12862
12863 This patch fixes a rare bug where an incorrect percentage drawtime
12864 could be displayed for a test, when the system clock was changed during
12865 a test running under Python 2 (we use :func:`python:time.monotonic`
12866 where it is available to avoid such problems). It also fixes a possible
12867 zero-division error that can occur when the underlying C library
12868 double-rounds an intermediate value in :func:`python:math.fsum` and
12869 gets the least significant bit wrong.
12870
12871 .. _v3.66.0:
12872
12873 -------------------
12874 3.66.0 - 2018-07-05
12875 -------------------
12876
12877 This release improves validation of the ``alphabet`` argument to the
12878 :func:`~hypothesis.strategies.text` strategy. The following misuses
12879 are now deprecated, and will be an error in a future version:
12880
12881 - passing an unordered collection (such as ``set('abc')``), which
12882 violates invariants about shrinking and reproducibility
12883 - passing an alphabet sequence with elements that are not strings
12884 - passing an alphabet sequence with elements that are not of length one,
12885 which violates any size constraints that may apply
12886
12887 Thanks to Sushobhit for adding these warnings (:issue:`1329`).
12888
12889 .. _v3.65.3:
12890
12891 -------------------
12892 3.65.3 - 2018-07-04
12893 -------------------
12894
12895 This release fixes a mostly theoretical bug where certain usage of the internal
12896 API could trigger an assertion error inside Hypothesis. It is unlikely that
12897 this problem is even possible to trigger through the public API.
12898
12899 .. _v3.65.2:
12900
12901 -------------------
12902 3.65.2 - 2018-07-04
12903 -------------------
12904
12905 This release fixes dependency information for coverage. Previously Hypothesis
12906 would allow installing :pypi:`coverage` with any version, but it only works
12907 with coverage 4.0 or later.
12908
12909 We now specify the correct metadata in our ``setup.py``, so Hypothesis will
12910 only allow installation with compatible versions of coverage.
12911
12912 .. _v3.65.1:
12913
12914 -------------------
12915 3.65.1 - 2018-07-03
12916 -------------------
12917
12918 This patch ensures that :ref:`stateful tests <stateful>` which raise an
12919 error from a :pypi:`pytest` helper still print the sequence of steps
12920 taken to reach that point (:issue:`1372`). This reporting was previously
12921 broken because the helpers inherit directly from :class:`python:BaseException`, and
12922 therefore require special handling to catch without breaking e.g. the use
12923 of ctrl-C to quit the test.
12924
12925 .. _v3.65.0:
12926
12927 -------------------
12928 3.65.0 - 2018-06-30
12929 -------------------
12930
12931 This release deprecates the ``max_shrinks`` setting
12932 in favor of an internal heuristic. If you need to avoid shrinking examples,
12933 use the :obj:`~hypothesis.settings.phases` setting instead. (:issue:`1235`)
12934
12935 .. _v3.64.2:
12936
12937 -------------------
12938 3.64.2 - 2018-06-27
12939 -------------------
12940
12941 This release fixes a bug where an internal assertion error could sometimes be
12942 triggered while shrinking a failing test.
12943
12944 .. _v3.64.1:
12945
12946 -------------------
12947 3.64.1 - 2018-06-27
12948 -------------------
12949
12950 This patch fixes type-checking errors in our vendored pretty-printer,
12951 which were ignored by our mypy config but visible for anyone else
12952 (whoops). Thanks to Pi Delport for reporting :issue:`1359` so promptly.
12953
12954 .. _v3.64.0:
12955
12956 -------------------
12957 3.64.0 - 2018-06-26
12958 -------------------
12959
12960 This release adds :ref:`an interface <custom-function-execution>`
12961 which can be used to insert a wrapper between the original test function and
12962 :func:`@given <hypothesis.given>` (:issue:`1257`). This will be particularly
12963 useful for test runner extensions such as :pypi:`pytest-trio`, but is
12964 not recommended for direct use by other users of Hypothesis.
12965
12966 .. _v3.63.0:
12967
12968 -------------------
12969 3.63.0 - 2018-06-26
12970 -------------------
12971
12972 This release adds a new mechanism to infer strategies for classes
12973 defined using :pypi:`attrs`, based on the type, converter, or
12974 validator of each attribute. This inference is now built in to
12975 :func:`~hypothesis.strategies.builds` and :func:`~hypothesis.strategies.from_type`.
12976
12977 On Python 2, :func:`~hypothesis.strategies.from_type` no longer generates
12978 instances of ``int`` when passed ``long``, or vice-versa.
12979
12980 .. _v3.62.0:
12981
12982 -------------------
12983 3.62.0 - 2018-06-26
12984 -------------------
12985
12986 This release adds :PEP:`484` type hints to Hypothesis on a provisional
12987 basis, using the comment-based syntax for Python 2 compatibility.
12988
12989 It *also* adds the ``py.typed`` marker specified in :PEP:`561`.
12990 After you ``pip install hypothesis``, :pypi:`mypy` 0.590 or later
12991 will therefore type-check your use of our public interface!
12992
12993 .. _v3.61.0:
12994
12995 -------------------
12996 3.61.0 - 2018-06-24
12997 -------------------
12998
12999 This release deprecates the use of :class:`~hypothesis.settings` as a
13000 context manager, the use of which is somewhat ambiguous.
13001
13002 Users should define settings with global state or with the
13003 :func:`@settings(...) <hypothesis.settings>` decorator.
13004
13005 .. _v3.60.1:
13006
13007 -------------------
13008 3.60.1 - 2018-06-20
13009 -------------------
13010
13011 Fixed a bug in generating an instance of a Django model from a
13012 strategy where the primary key is generated as part of the
13013 strategy. See :ref:`details here <django-generating-primary-key>`.
13014
13015 Thanks to Tim Martin for this contribution.
13016
13017 .. _v3.60.0:
13018
13019 -------------------
13020 3.60.0 - 2018-06-20
13021 -------------------
13022
13023 This release adds the :func:`@initialize <hypothesis.stateful.initialize>`
13024 decorator for stateful testing (originally discussed in :issue:`1216`).
13025 All :func:`@initialize <hypothesis.stateful.initialize>` rules will be called
13026 once each in an arbitrary order before any normal rule is called.
13027
13028 .. _v3.59.3:
13029
13030 -------------------
13031 3.59.3 - 2018-06-19
13032 -------------------
13033
13034 This is a no-op release to take into account some changes to the release
13035 process. It should have no user visible effect.
13036
13037 .. _v3.59.2:
13038
13039 -------------------
13040 3.59.2 - 2018-06-18
13041 -------------------
13042
13043 This adds support for partially sorting examples which cannot be fully sorted.
13044 For example, [5, 4, 3, 2, 1, 0] with a constraint that the first element needs
13045 to be larger than the last becomes [1, 2, 3, 4, 5, 0].
13046
13047 Thanks to Luke for contributing.
13048
13049 .. _v3.59.1:
13050
13051 -------------------
13052 3.59.1 - 2018-06-16
13053 -------------------
13054
13055 This patch uses :func:`python:random.getstate` and :func:`python:random.setstate`
13056 to restore the PRNG state after :func:`@given <hypothesis.given>` runs
13057 deterministic tests. Without restoring state, you might have noticed problems
13058 such as :issue:`1266`. The fix also applies to stateful testing (:issue:`702`).
13059
13060 .. _v3.59.0:
13061
13062 -------------------
13063 3.59.0 - 2018-06-14
13064 -------------------
13065
13066 This release adds the :func:`~hypothesis.strategies.emails` strategy,
13067 which generates unicode strings representing an email address.
13068
13069 Thanks to Sushobhit for moving this to the public API (:issue:`162`).
13070
13071 .. _v3.58.1:
13072
13073 -------------------
13074 3.58.1 - 2018-06-13
13075 -------------------
13076
13077 This improves the shrinker. It can now reorder examples: 3 1 2 becomes 1 2 3.
13078
13079 Thanks to Luke for contributing.
13080
13081 .. _v3.58.0:
13082
13083 -------------------
13084 3.58.0 - 2018-06-13
13085 -------------------
13086
13087 This adds a new extra :py:func:`~hypothesis.extra.dateutil.timezones` strategy
13088 that generates :pypi:`dateutil timezones <python-dateutil>`.
13089
13090 Thanks to Conrad for contributing.
13091
13092 .. _v3.57.0:
13093
13094 -------------------
13095 3.57.0 - 2018-05-20
13096 -------------------
13097
13098 Using an unordered collection with the :func:`~hypothesis.strategies.permutations`
13099 strategy has been deprecated because the order in which e.g. a set shrinks is
13100 arbitrary. This may cause different results between runs.
13101
13102 .. _v3.56.10:
13103
13104 --------------------
13105 3.56.10 - 2018-05-16
13106 --------------------
13107
13108 This release makes ``hypothesis.settings.define_setting``
13109 a private method, which has the effect of hiding it from the
13110 documentation.
13111
13112 .. _v3.56.9:
13113
13114 -------------------
13115 3.56.9 - 2018-05-11
13116 -------------------
13117
13118 This is another release with no functionality changes as part of changes to
13119 Hypothesis's new release tagging scheme.
13120
13121 .. _v3.56.8:
13122
13123 -------------------
13124 3.56.8 - 2018-05-10
13125 -------------------
13126
13127 This is a release with no functionality changes that moves Hypothesis over to
13128 a new release tagging scheme.
13129
13130 .. _v3.56.7:
13131
13132 -------------------
13133 3.56.7 - 2018-05-10
13134 -------------------
13135
13136 This release provides a performance improvement for most tests, but in
13137 particular users of :func:`~hypothesis.strategies.sampled_from` who don't
13138 have numpy installed should see a significant performance improvement.
13139
13140 .. _v3.56.6:
13141
13142 -------------------
13143 3.56.6 - 2018-05-09
13144 -------------------
13145
13146 This patch contains further internal work to support Mypy.
13147 There are no user-visible changes... yet.
13148
13149 .. _v3.56.5:
13150
13151 -------------------
13152 3.56.5 - 2018-04-22
13153 -------------------
13154
13155 This patch contains some internal refactoring to run :pypi:`mypy` in CI.
13156 There are no user-visible changes.
13157
13158 .. _v3.56.4:
13159
13160 -------------------
13161 3.56.4 - 2018-04-21
13162 -------------------
13163
13164 This release involves some very minor internal clean up and should have no
13165 user visible effect at all.
13166
13167 .. _v3.56.3:
13168
13169 -------------------
13170 3.56.3 - 2018-04-20
13171 -------------------
13172
13173 This release fixes a problem introduced in :ref:`3.56.0 <v3.56.0>` where
13174 setting the hypothesis home directory (through currently undocumented
13175 means) would no longer result in the default database location living
13176 in the new home directory.
13177
13178 .. _v3.56.2:
13179
13180 -------------------
13181 3.56.2 - 2018-04-20
13182 -------------------
13183
13184 This release fixes a problem introduced in :ref:`3.56.0 <v3.56.0>` where
13185 setting :obj:`~hypothesis.settings.max_examples` to ``1`` would result in tests
13186 failing with ``Unsatisfiable``. This problem could also occur in other harder
13187 to trigger circumstances (e.g. by setting it to a low value, having a hard to
13188 satisfy assumption, and disabling health checks).
13189
13190 .. _v3.56.1:
13191
13192 -------------------
13193 3.56.1 - 2018-04-20
13194 -------------------
13195
13196 This release fixes a problem that was introduced in :ref:`3.56.0 <v3.56.0>`:
13197 Use of the ``HYPOTHESIS_VERBOSITY_LEVEL`` environment variable was, rather
13198 than deprecated, actually broken due to being read before various setup
13199 the deprecation path needed was done. It now works correctly (and emits a
13200 deprecation warning).
13201
13202 .. _v3.56.0:
13203
13204 -------------------
13205 3.56.0 - 2018-04-17
13206 -------------------
13207
13208 This release deprecates several redundant or internally oriented
13209 :class:`~hypothesis.settings`, working towards an orthogonal set of
13210 configuration options that are widely useful *without* requiring any
13211 knowledge of our internals (:issue:`535`).
13212
13213 - Deprecated settings that no longer have any effect are no longer
13214 shown in the ``__repr__`` unless set to a non-default value.
13215 - ``hypothesis.settings.perform_health_check`` is deprecated, as it
13216 duplicates :obj:`~hypothesis.settings.suppress_health_check`.
13217 - ``hypothesis.settings.max_iterations`` is deprecated and disabled,
13218 because we can usually get better behaviour from an internal heuristic
13219 than a user-controlled setting.
13220 - ``hypothesis.settings.min_satisfying_examples`` is deprecated and
13221 disabled, due to overlap with the
13222 :obj:`~hypothesis.HealthCheck.filter_too_much` healthcheck
13223 and poor interaction with :obj:`~hypothesis.settings.max_examples`.
13224 - ``HYPOTHESIS_VERBOSITY_LEVEL`` is now deprecated. Set
13225 :obj:`~hypothesis.settings.verbosity` through the profile system instead.
13226 - Examples tried by ``find()`` are now reported at ``debug``
13227 verbosity level (as well as ``verbose`` level).
13228
13229 .. _v3.55.6:
13230
13231 -------------------
13232 3.55.6 - 2018-04-14
13233 -------------------
13234
13235 This release fixes a somewhat obscure condition (:issue:`1230`) under which you
13236 could occasionally see a failing test trigger an assertion error inside
13237 Hypothesis instead of failing normally.
13238
13239 .. _v3.55.5:
13240
13241 -------------------
13242 3.55.5 - 2018-04-14
13243 -------------------
13244
13245 This patch fixes one possible cause of :issue:`966`. When running
13246 Python 2 with hash randomisation, passing a :obj:`python:bytes` object
13247 to :func:`python:random.seed` would use ``version=1``, which broke
13248 :obj:`~hypothesis.settings.derandomize` (because the seed depended on
13249 a randomised hash). If :obj:`~hypothesis.settings.derandomize` is
13250 *still* nondeterministic for you, please open an issue.
13251
13252 .. _v3.55.4:
13253
13254 -------------------
13255 3.55.4 - 2018-04-13
13256 -------------------
13257
13258 This patch makes a variety of minor improvements to the documentation,
13259 and improves a few validation messages for invalid inputs.
13260
13261 .. _v3.55.3:
13262
13263 -------------------
13264 3.55.3 - 2018-04-12
13265 -------------------
13266
13267 This release updates the URL metadata associated with the PyPI package (again).
13268 It has no other user visible effects.
13269
13270 .. _v3.55.2:
13271
13272 -------------------
13273 3.55.2 - 2018-04-11
13274 -------------------
13275
13276 This release updates the URL metadata associated with the PyPI package.
13277 It has no other user visible effects.
13278
13279 .. _v3.55.1:
13280
13281 -------------------
13282 3.55.1 - 2018-04-06
13283 -------------------
13284
13285 This patch relaxes constraints in our tests on the expected values returned
13286 by the standard library function :func:`~python:math.hypot` and the internal
13287 helper function ``cathetus``, to fix near-exact
13288 test failures on some 32-bit systems used by downstream packagers.
13289
13290 .. _v3.55.0:
13291
13292 -------------------
13293 3.55.0 - 2018-04-05
13294 -------------------
13295
13296 This release includes several improvements to the handling of the
13297 :obj:`~hypothesis.settings.database` setting.
13298
13299 - The ``database_file`` setting was a historical
13300 artefact, and you should just use :obj:`~hypothesis.settings.database`
13301 directly.
13302 - The ``HYPOTHESIS_DATABASE_FILE`` environment variable is
13303 deprecated, in favor of :meth:`~hypothesis.settings.load_profile` and
13304 the :obj:`~hypothesis.settings.database` setting.
13305 - If you have not configured the example database at all and the default
13306 location is not usable (due to e.g. permissions issues), Hypothesis
13307 will fall back to an in-memory database. This is not persisted between
13308 sessions, but means that the defaults work on read-only filesystems.
13309
13310 .. _v3.54.0:
13311
13312 -------------------
13313 3.54.0 - 2018-04-04
13314 -------------------
13315
13316 This release improves the :func:`~hypothesis.strategies.complex_numbers`
13317 strategy, which now supports ``min_magnitude`` and ``max_magnitude``
13318 arguments, along with ``allow_nan`` and ``allow_infinity`` like for
13319 :func:`~hypothesis.strategies.floats`.
13320
13321 Thanks to J.J. Green for this feature.
13322
13323 .. _v3.53.0:
13324
13325 -------------------
13326 3.53.0 - 2018-04-01
13327 -------------------
13328
13329 This release removes support for Django 1.8, which reached end of life on
13330 2018-04-01. You can see Django's release and support schedule
13331 `on the Django Project website <https://www.djangoproject.com/download/#supported-versions>`_.
13332
13333 .. _v3.52.3:
13334
13335 -------------------
13336 3.52.3 - 2018-04-01
13337 -------------------
13338
13339 This patch fixes the ``min_satisfying_examples`` settings
13340 documentation, by explaining that example shrinking is tracked at the level
13341 of the underlying bytestream rather than the output value.
13342
13343 The output from ``find()`` in verbose mode has also been
13344 adjusted - see the example session for |Verbosity| - to avoid
13345 duplicating lines when the example repr is constant, even if the underlying
13346 representation has been shrunken.
13347
13348 .. _v3.52.2:
13349
13350 -------------------
13351 3.52.2 - 2018-03-30
13352 -------------------
13353
13354 This release improves the output of failures with
13355 :ref:`rule based stateful testing <stateful>` in two ways:
13356
13357 * The output from it is now usually valid Python code.
13358 * When the same value has two different names because it belongs to two different
13359 bundles, it will now display with the name associated with the correct bundle
13360 for a rule argument where it is used.
13361
13362 .. _v3.52.1:
13363
13364 -------------------
13365 3.52.1 - 2018-03-29
13366 -------------------
13367
13368 This release improves the behaviour of :ref:`stateful testing <stateful>`
13369 in two ways:
13370
13371 * Previously some runs would run no steps (:issue:`376`). This should no longer
13372 happen.
13373 * RuleBasedStateMachine tests which used bundles extensively would often shrink
13374 terribly. This should now be significantly improved, though there is likely
13375 a lot more room for improvement.
13376
13377 This release also involves a low level change to how ranges of integers are
13378 handles which may result in other improvements to shrink quality in some cases.
13379
13380 .. _v3.52.0:
13381
13382 -------------------
13383 3.52.0 - 2018-03-24
13384 -------------------
13385
13386 This release deprecates use of :func:`@settings(...) <hypothesis.settings>`
13387 as a decorator, on functions or methods that are not also decorated with
13388 :func:`@given <hypothesis.given>`. You can still apply these decorators
13389 in any order, though you should only do so once each.
13390
13391 Applying :func:`@given <hypothesis.given>` twice was already deprecated, and
13392 applying :func:`@settings(...) <hypothesis.settings>` twice is deprecated in
13393 this release and will become an error in a future version. Neither could ever
13394 be used twice to good effect.
13395
13396 Using :func:`@settings(...) <hypothesis.settings>` as the sole decorator on
13397 a test is completely pointless, so this common usage error will become an
13398 error in a future version of Hypothesis.
13399
13400 .. _v3.51.0:
13401
13402 -------------------
13403 3.51.0 - 2018-03-24
13404 -------------------
13405
13406 This release deprecates the ``average_size`` argument to
13407 :func:`~hypothesis.strategies.lists` and other collection strategies.
13408 You should simply delete it wherever it was used in your tests, as it
13409 no longer has any effect.
13410
13411 In early versions of Hypothesis, the ``average_size`` argument was treated
13412 as a hint about the distribution of examples from a strategy. Subsequent
13413 improvements to the conceptual model and the engine for generating and
13414 shrinking examples mean it is more effective to simply describe what
13415 constitutes a valid example, and let our internals handle the distribution.
13416
13417 .. _v3.50.3:
13418
13419 -------------------
13420 3.50.3 - 2018-03-24
13421 -------------------
13422
13423 This patch contains some internal refactoring so that we can run
13424 with warnings as errors in CI.
13425
13426 .. _v3.50.2:
13427
13428 -------------------
13429 3.50.2 - 2018-03-20
13430 -------------------
13431
13432 This has no user-visible changes except one slight formatting change to one docstring, to avoid a deprecation warning.
13433
13434 .. _v3.50.1:
13435
13436 -------------------
13437 3.50.1 - 2018-03-20
13438 -------------------
13439
13440 This patch fixes an internal error introduced in :ref:`3.48.0 <v3.48.0>`, where a check
13441 for the Django test runner would expose import-time errors in Django
13442 configuration (:issue:`1167`).
13443
13444 .. _v3.50.0:
13445
13446 -------------------
13447 3.50.0 - 2018-03-19
13448 -------------------
13449
13450 This release improves validation of numeric bounds for some strategies.
13451
13452 - :func:`~hypothesis.strategies.integers` and :func:`~hypothesis.strategies.floats`
13453 now raise ``InvalidArgument`` if passed a ``min_value`` or ``max_value``
13454 which is not an instance of :class:`~python:numbers.Real`, instead of
13455 various internal errors.
13456 - :func:`~hypothesis.strategies.floats` now converts its bounding values to
13457 the nearest float above or below the min or max bound respectively, instead
13458 of just casting to float. The old behaviour was incorrect in that you could
13459 generate ``float(min_value)``, even when this was less than ``min_value``
13460 itself (possible with eg. fractions).
13461 - When both bounds are provided to :func:`~hypothesis.strategies.floats` but
13462 there are no floats in the interval, such as ``[(2**54)+1 .. (2**55)-1]``,
13463 InvalidArgument is raised.
13464 - :func:`~hypothesis.strategies.decimals` gives a more useful error message
13465 if passed a string that cannot be converted to :class:`~python:decimal.Decimal`
13466 in a context where this error is not trapped.
13467
13468 Code that previously **seemed** to work may be explicitly broken if there
13469 were no floats between ``min_value`` and ``max_value`` (only possible with
13470 non-float bounds), or if a bound was not a :class:`~python:numbers.Real`
13471 number but still allowed in :obj:`python:math.isnan` (some custom classes
13472 with a ``__float__`` method).
13473
13474 .. _v3.49.1:
13475
13476 -------------------
13477 3.49.1 - 2018-03-15
13478 -------------------
13479
13480 This patch fixes our tests for Numpy dtype strategies on big-endian platforms,
13481 where the strategy behaved correctly but the test assumed that the native byte
13482 order was little-endian.
13483
13484 There is no user impact unless you are running our test suite on big-endian
13485 platforms. Thanks to Graham Inggs for reporting :issue:`1164`.
13486
13487 .. _v3.49.0:
13488
13489 -------------------
13490 3.49.0 - 2018-03-12
13491 -------------------
13492
13493 This release deprecates passing ``elements=None`` to collection strategies,
13494 such as :func:`~hypothesis.strategies.lists`.
13495
13496 Requiring ``lists(nothing())`` or ``builds(list)`` instead of ``lists()``
13497 means slightly more typing, but also improves the consistency and
13498 discoverability of our API - as well as showing how to compose or
13499 construct strategies in ways that still work in more complex situations.
13500
13501 Passing a nonzero max_size to a collection strategy where the elements
13502 strategy contains no values is now deprecated, and will be an error in a
13503 future version. The equivalent with ``elements=None`` is already an error.
13504
13505 .. _v3.48.1:
13506
13507 -------------------
13508 3.48.1 - 2018-03-05
13509 -------------------
13510
13511 This patch will minimize examples that would come out non-minimal in previous versions. Thanks to Kyle Reeve for this patch.
13512
13513 .. _v3.48.0:
13514
13515 -------------------
13516 3.48.0 - 2018-03-05
13517 -------------------
13518
13519 This release improves some "unhappy paths" when using Hypothesis
13520 with the standard library :mod:`python:unittest` module:
13521
13522 - Applying :func:`@given <hypothesis.given>` to a non-test method which is
13523 overridden from :class:`python:unittest.TestCase`, such as ``setUp``,
13524 raises :attr:`a new health check <hypothesis.HealthCheck.not_a_test_method>`.
13525 (:issue:`991`)
13526 - Using :meth:`~python:unittest.TestCase.subTest` within a test decorated
13527 with :func:`@given <hypothesis.given>` would leak intermediate results
13528 when tests were run under the :mod:`python:unittest` test runner.
13529 Individual reporting of failing subtests is now disabled during a test
13530 using :func:`@given <hypothesis.given>`. (:issue:`1071`)
13531 - :func:`@given <hypothesis.given>` is still not a class decorator, but the
13532 error message if you try using it on a class has been improved.
13533
13534 As a related improvement, using :class:`django:django.test.TestCase` with
13535 :func:`@given <hypothesis.given>` instead of
13536 :class:`hypothesis.extra.django.TestCase` raises an explicit error instead
13537 of running all examples in a single database transaction.
13538
13539 .. _v3.47.0:
13540
13541 -------------------
13542 3.47.0 - 2018-03-02
13543 -------------------
13544
13545 :obj:`~hypothesis.settings.register_profile` now accepts keyword arguments
13546 for specific settings, and the parent settings object is now optional.
13547 Using a ``name`` for a registered profile which is not a string was never
13548 suggested, but it is now also deprecated and will eventually be an error.
13549
13550 .. _v3.46.2:
13551
13552 -------------------
13553 3.46.2 - 2018-03-01
13554 -------------------
13555
13556 This release removes an unnecessary branch from the code, and has no user-visible impact.
13557
13558 .. _v3.46.1:
13559
13560 -------------------
13561 3.46.1 - 2018-03-01
13562 -------------------
13563
13564 This changes only the formatting of our docstrings and should have no user-visible effects.
13565
13566 .. _v3.46.0:
13567
13568 -------------------
13569 3.46.0 - 2018-02-26
13570 -------------------
13571
13572 :func:`~hypothesis.strategies.characters` has improved docs about
13573 what arguments are valid, and additional validation logic to raise a
13574 clear error early (instead of e.g. silently ignoring a bad argument).
13575 Categories may be specified as the Unicode 'general category'
13576 (eg ``'Nd'``), or as the 'major category' (eg ``['N', 'Lu']``
13577 is equivalent to ``['Nd', 'Nl', 'No', 'Lu']``).
13578
13579 In previous versions, general categories were supported and all other
13580 input was silently ignored. Now, major categories are supported in
13581 addition to general categories (which may change the behaviour of some
13582 existing code), and all other input is deprecated.
13583
13584 .. _v3.45.5:
13585
13586 -------------------
13587 3.45.5 - 2018-02-26
13588 -------------------
13589
13590 This patch improves strategy inference in ``hypothesis.extra.django``
13591 to account for some validators in addition to field type - see
13592 :issue:`1116` for ongoing work in this space.
13593
13594 Specifically, if a :class:`~django:django.db.models.CharField` or
13595 :class:`~django:django.db.models.TextField` has an attached
13596 :class:`~django:django.core.validators.RegexValidator`, we now use
13597 :func:`~hypothesis.strategies.from_regex` instead of
13598 :func:`~hypothesis.strategies.text` as the underlying strategy.
13599 This allows us to generate examples of the default
13600 :class:`~django:django.contrib.auth.models.User` model, closing :issue:`1112`.
13601
13602 .. _v3.45.4:
13603
13604 -------------------
13605 3.45.4 - 2018-02-25
13606 -------------------
13607
13608 This patch improves some internal debugging information, fixes
13609 a typo in a validation error message, and expands the documentation
13610 for new contributors.
13611
13612 .. _v3.45.3:
13613
13614 -------------------
13615 3.45.3 - 2018-02-23
13616 -------------------
13617
13618 This patch may improve example shrinking slightly for some strategies.
13619
13620 .. _v3.45.2:
13621
13622 -------------------
13623 3.45.2 - 2018-02-18
13624 -------------------
13625
13626 This release makes our docstring style more consistent, thanks to
13627 :pypi:`flake8-docstrings`. There are no user-visible changes.
13628
13629 .. _v3.45.1:
13630
13631 -------------------
13632 3.45.1 - 2018-02-17
13633 -------------------
13634
13635 This fixes an indentation issue in docstrings for
13636 :func:`~hypothesis.strategies.datetimes`, :func:`~hypothesis.strategies.dates`,
13637 :func:`~hypothesis.strategies.times`, and
13638 :func:`~hypothesis.strategies.timedeltas`.
13639
13640 .. _v3.45.0:
13641
13642 -------------------
13643 3.45.0 - 2018-02-13
13644 -------------------
13645
13646 This release fixes :func:`~hypothesis.strategies.builds` so that ``target``
13647 can be used as a keyword argument for passing values to the target. The target
13648 itself can still be specified as a keyword argument, but that behavior is now
13649 deprecated. The target should be provided as the first positional argument.
13650
13651 .. _v3.44.26:
13652
13653 --------------------
13654 3.44.26 - 2018-02-06
13655 --------------------
13656
13657 This release fixes some formatting issues in the Hypothesis source code.
13658 It should have no externally visible effects.
13659
13660 .. _v3.44.25:
13661
13662 --------------------
13663 3.44.25 - 2018-02-05
13664 --------------------
13665
13666 This release changes the way in which Hypothesis tries to shrink the size of
13667 examples. It probably won't have much impact, but might make shrinking faster
13668 in some cases. It is unlikely but not impossible that it will change the
13669 resulting examples.
13670
13671 .. _v3.44.24:
13672
13673 --------------------
13674 3.44.24 - 2018-01-27
13675 --------------------
13676
13677 This release fixes dependency information when installing Hypothesis
13678 from a binary "wheel" distribution.
13679
13680 - The ``install_requires`` for :pypi:`enum34` is resolved at install
13681 time, rather than at build time (with potentially different results).
13682 - Django has fixed their ``python_requires`` for versions 2.0.0 onward,
13683 simplifying Python2-compatible constraints for downstream projects.
13684
13685 .. _v3.44.23:
13686
13687 --------------------
13688 3.44.23 - 2018-01-24
13689 --------------------
13690
13691 This release improves shrinking in a class of pathological examples that you
13692 are probably never hitting in practice. If you *are* hitting them in practice
13693 this should be a significant speed up in shrinking. If you are not, you are
13694 very unlikely to notice any difference. You might see a slight slow down and/or
13695 slightly better falsifying examples.
13696
13697 .. _v3.44.22:
13698
13699 --------------------
13700 3.44.22 - 2018-01-23
13701 --------------------
13702
13703 This release fixes a dependency problem. It was possible to install
13704 Hypothesis with an old version of :pypi:`attrs`, which would throw a
13705 ``TypeError`` as soon as you tried to import hypothesis. Specifically, you
13706 need attrs 16.0.0 or newer.
13707
13708 Hypothesis will now require the correct version of attrs when installing.
13709
13710 .. _v3.44.21:
13711
13712 --------------------
13713 3.44.21 - 2018-01-22
13714 --------------------
13715
13716 This change adds some additional structural information that Hypothesis will
13717 use to guide its search.
13718
13719 You mostly shouldn't see much difference from this. The two most likely effects
13720 you would notice are:
13721
13722 1. Hypothesis stores slightly more examples in its database for passing tests.
13723 2. Hypothesis *may* find new bugs that it was previously missing, but it
13724 probably won't (this is a basic implementation of the feature that is
13725 intended to support future work. Although it is useful on its own, it's not
13726 *very* useful on its own).
13727
13728 .. _v3.44.20:
13729
13730 --------------------
13731 3.44.20 - 2018-01-21
13732 --------------------
13733
13734 This is a small refactoring release that changes how Hypothesis tracks some
13735 information about the boundary of examples in its internal representation.
13736
13737 You are unlikely to see much difference in behaviour, but memory usage and
13738 run time may both go down slightly during normal test execution, and when
13739 failing Hypothesis might print its failing example slightly sooner.
13740
13741 .. _v3.44.19:
13742
13743 --------------------
13744 3.44.19 - 2018-01-21
13745 --------------------
13746
13747 This changes how we compute the default ``average_size`` for all collection
13748 strategies. Previously setting a ``max_size`` without setting an
13749 ``average_size`` would have the seemingly paradoxical effect of making data
13750 generation *slower*, because it would raise the average size from its default.
13751 Now setting ``max_size`` will either leave the default unchanged or lower it
13752 from its default.
13753
13754 If you are currently experiencing this problem, this may make your tests
13755 substantially faster. If you are not, this will likely have no effect on you.
13756
13757 .. _v3.44.18:
13758
13759 --------------------
13760 3.44.18 - 2018-01-20
13761 --------------------
13762
13763 This is a small refactoring release that changes how Hypothesis detects when
13764 the structure of data generation depends on earlier values generated (e.g. when
13765 using |.flatmap| or :func:`~hypothesis.strategies.composite`).
13766 It should not have any observable effect on behaviour.
13767
13768 .. _v3.44.17:
13769
13770 --------------------
13771 3.44.17 - 2018-01-15
13772 --------------------
13773
13774 This release fixes a typo in internal documentation, and has no user-visible impact.
13775
13776 .. _v3.44.16:
13777
13778 --------------------
13779 3.44.16 - 2018-01-13
13780 --------------------
13781
13782 This release improves test case reduction for recursive data structures.
13783 Hypothesis now guarantees that whenever a strategy calls itself recursively
13784 (usually this will happen because you are using :func:`~hypothesis.strategies.deferred`),
13785 any recursive call may replace the top level value. e.g. given a tree structure,
13786 Hypothesis will always try replacing it with a subtree.
13787
13788 Additionally this introduces a new heuristic that may in some circumstances
13789 significantly speed up test case reduction - Hypothesis should be better at
13790 immediately replacing elements drawn inside another strategy with their minimal
13791 possible value.
13792
13793 .. _v3.44.15:
13794
13795 --------------------
13796 3.44.15 - 2018-01-13
13797 --------------------
13798
13799 :func:`~hypothesis.strategies.from_type` can now resolve recursive types
13800 such as binary trees (:issue:`1004`). Detection of non-type arguments has
13801 also improved, leading to better error messages in many cases involving
13802 :pep:`forward references <484#forward-references>`.
13803
13804 .. _v3.44.14:
13805
13806 --------------------
13807 3.44.14 - 2018-01-08
13808 --------------------
13809
13810 This release fixes a bug in the shrinker that prevented the optimisations in
13811 :ref:`3.44.6 <v3.44.6>` from working in some cases. It would not have worked correctly when
13812 filtered examples were nested (e.g. with a set of integers in some range).
13813
13814 This would not have resulted in any correctness problems, but shrinking may
13815 have been slower than it otherwise could be.
13816
13817 .. _v3.44.13:
13818
13819 --------------------
13820 3.44.13 - 2018-01-08
13821 --------------------
13822
13823 This release changes the average bit length of values drawn from
13824 :func:`~hypothesis.strategies.integers` to be much smaller. Additionally it
13825 changes the shrinking order so that now size is considered before sign - e.g.
13826 -1 will be preferred to +10.
13827
13828 The new internal format for integers required some changes to the minimizer to
13829 make work well, so you may also see some improvements to example quality in
13830 unrelated areas.
13831
13832 .. _v3.44.12:
13833
13834 --------------------
13835 3.44.12 - 2018-01-07
13836 --------------------
13837
13838 This changes Hypothesis's internal implementation of weighted sampling. This
13839 will affect example distribution and quality, but you shouldn't see any other
13840 effects.
13841
13842 .. _v3.44.11:
13843
13844 --------------------
13845 3.44.11 - 2018-01-06
13846 --------------------
13847
13848 This is a change to some internals around how Hypothesis handles avoiding
13849 generating duplicate examples and seeking out novel regions of the search
13850 space.
13851
13852 You are unlikely to see much difference as a result of it, but it fixes
13853 a bug where an internal assertion could theoretically be triggered and has some
13854 minor effects on the distribution of examples so could potentially find bugs
13855 that have previously been missed.
13856
13857 .. _v3.44.10:
13858
13859 --------------------
13860 3.44.10 - 2018-01-06
13861 --------------------
13862
13863 This patch avoids creating debug statements when debugging is disabled.
13864 Profiling suggests this is a 5-10% performance improvement (:issue:`1040`).
13865
13866 .. _v3.44.9:
13867
13868 -------------------
13869 3.44.9 - 2018-01-06
13870 -------------------
13871
13872 This patch blacklists null characters (``'\x00'``) in automatically created
13873 strategies for Django :obj:`~django:django.db.models.CharField` and
13874 :obj:`~django:django.db.models.TextField`, due to a database issue which
13875 `was recently fixed upstream <https://code.djangoproject.com/ticket/28201>`_
13876 (Hypothesis :issue:`1045`).
13877
13878 .. _v3.44.8:
13879
13880 -------------------
13881 3.44.8 - 2018-01-06
13882 -------------------
13883
13884 This release makes the Hypothesis shrinker slightly less greedy in order to
13885 avoid local minima - when it gets stuck, it makes a small attempt to search
13886 around the final example it would previously have returned to find a new
13887 starting point to shrink from. This should improve example quality in some
13888 cases, especially ones where the test data has dependencies among parts of it
13889 that make it difficult for Hypothesis to proceed.
13890
13891 .. _v3.44.7:
13892
13893 -------------------
13894 3.44.7 - 2018-01-04
13895 -------------------
13896
13897 This release adds support for `Django 2
13898 <https://www.djangoproject.com/weblog/2017/dec/02/django-20-released/>`_ in
13899 the hypothesis-django extra.
13900
13901 This release drops support for Django 1.10, as it is no longer supported by
13902 the Django team.
13903
13904 .. _v3.44.6:
13905
13906 -------------------
13907 3.44.6 - 2018-01-02
13908 -------------------
13909
13910 This release speeds up test case reduction in many examples by being better at
13911 detecting large shrinks it can use to discard redundant parts of its input.
13912 This will be particularly noticeable in examples that make use of filtering
13913 and for some integer ranges.
13914
13915 .. _v3.44.5:
13916
13917 -------------------
13918 3.44.5 - 2018-01-02
13919 -------------------
13920
13921 Happy new year!
13922
13923 This is a no-op release that updates the year range on all of
13924 the copyright headers in our source to include 2018.
13925
13926 .. _v3.44.4:
13927
13928 -------------------
13929 3.44.4 - 2017-12-23
13930 -------------------
13931
13932 This release fixes :issue:`1041`, which slowed tests by up to 6%
13933 due to broken caching.
13934
13935 .. _v3.44.3:
13936
13937 -------------------
13938 3.44.3 - 2017-12-21
13939 -------------------
13940
13941 This release improves the shrinker in cases where examples drawn earlier can
13942 affect how much data is drawn later (e.g. when you draw a length parameter in
13943 a composite and then draw that many elements). Examples found in cases like
13944 this should now be much closer to minimal.
13945
13946 .. _v3.44.2:
13947
13948 -------------------
13949 3.44.2 - 2017-12-20
13950 -------------------
13951
13952 This is a pure refactoring release which changes how Hypothesis manages its
13953 set of examples internally. It should have no externally visible effects.
13954
13955 .. _v3.44.1:
13956
13957 -------------------
13958 3.44.1 - 2017-12-18
13959 -------------------
13960
13961 This release fixes :issue:`997`, in which under some circumstances the body of
13962 tests run under Hypothesis would not show up when run under coverage even
13963 though the tests were run and the code they called outside of the test file
13964 would show up normally.
13965
13966 .. _v3.44.0:
13967
13968 -------------------
13969 3.44.0 - 2017-12-17
13970 -------------------
13971
13972 This release adds a new feature: The :func:`@reproduce_failure <hypothesis.reproduce_failure>` decorator,
13973 designed to make it easy to use Hypothesis's binary format for examples to
13974 reproduce a problem locally without having to share your example database
13975 between machines.
13976
13977 This also changes when seeds are printed:
13978
13979 * They will no longer be printed for
13980 normal falsifying examples, as there are now adequate ways of reproducing those
13981 for all cases, so it just contributes noise.
13982 * They will once again be printed when reusing examples from the database, as
13983 health check failures should now be more reliable in this scenario so it will
13984 almost always work in this case.
13985
13986 This work was funded by `Smarkets <https://smarkets.com/>`_.
13987
13988 .. _v3.43.1:
13989
13990 -------------------
13991 3.43.1 - 2017-12-17
13992 -------------------
13993
13994 This release fixes a bug with Hypothesis's database management - examples that
13995 were found in the course of shrinking were saved in a way that indicated that
13996 they had distinct causes, and so they would all be retried on the start of the
13997 next test. The intended behaviour, which is now what is implemented, is that
13998 only a bounded subset of these examples would be retried.
13999
14000 .. _v3.43.0:
14001
14002 -------------------
14003 3.43.0 - 2017-12-17
14004 -------------------
14005
14006 :exc:`~hypothesis.errors.HypothesisDeprecationWarning` now inherits from
14007 :exc:`python:FutureWarning` instead of :exc:`python:DeprecationWarning`,
14008 as recommended by :pep:`565` for user-facing warnings (:issue:`618`).
14009 If you have not changed the default warnings settings, you will now see
14010 each distinct :exc:`~hypothesis.errors.HypothesisDeprecationWarning`
14011 instead of only the first.
14012
14013 .. _v3.42.2:
14014
14015 -------------------
14016 3.42.2 - 2017-12-12
14017 -------------------
14018
14019 This patch fixes :issue:`1017`, where instances of a list or tuple subtype
14020 used as an argument to a strategy would be coerced to tuple.
14021
14022 .. _v3.42.1:
14023
14024 -------------------
14025 3.42.1 - 2017-12-10
14026 -------------------
14027
14028 This release has some internal cleanup, which makes reading the code
14029 more pleasant and may shrink large examples slightly faster.
14030
14031 .. _v3.42.0:
14032
14033 -------------------
14034 3.42.0 - 2017-12-09
14035 -------------------
14036
14037 This release deprecates ``faker-extra``, which was designed as a transition
14038 strategy but does not support example shrinking or coverage-guided discovery.
14039
14040 .. _v3.41.0:
14041
14042 -------------------
14043 3.41.0 - 2017-12-06
14044 -------------------
14045
14046 :func:`~hypothesis.strategies.sampled_from` can now sample from
14047 one-dimensional numpy ndarrays. Sampling from multi-dimensional
14048 ndarrays still results in a deprecation warning. Thanks to Charlie
14049 Tanksley for this patch.
14050
14051 .. _v3.40.1:
14052
14053 -------------------
14054 3.40.1 - 2017-12-04
14055 -------------------
14056
14057 This release makes two changes:
14058
14059 * It makes the calculation of some of the metadata that Hypothesis uses for
14060 shrinking occur lazily. This should speed up performance of test case
14061 generation a bit because it no longer calculates information it doesn't need.
14062 * It improves the shrinker for certain classes of nested examples. e.g. when
14063 shrinking lists of lists, the shrinker is now able to concatenate two
14064 adjacent lists together into a single list. As a result of this change,
14065 shrinking may get somewhat slower when the minimal example found is large.
14066
14067 .. _v3.40.0:
14068
14069 -------------------
14070 3.40.0 - 2017-12-02
14071 -------------------
14072
14073 This release improves how various ways of seeding Hypothesis interact with the
14074 example database:
14075
14076 * Using the example database with :func:`~hypothesis.seed` is now deprecated.
14077 You should set ``database=None`` if you are doing that. This will only warn
14078 if you actually load examples from the database while using ``@seed``.
14079 * The :attr:`~hypothesis.settings.derandomize` will behave the same way as
14080 ``@seed``.
14081 * Using ``--hypothesis-seed`` will disable use of the database.
14082 * If a test used examples from the database, it will not suggest using a seed
14083 to reproduce it, because that won't work.
14084
14085 This work was funded by `Smarkets <https://smarkets.com/>`_.
14086
14087 .. _v3.39.0:
14088
14089 -------------------
14090 3.39.0 - 2017-12-01
14091 -------------------
14092
14093 This release adds a new health check that checks if the smallest "natural"
14094 possible example of your test case is very large - this will tend to cause
14095 Hypothesis to generate bad examples and be quite slow.
14096
14097 This work was funded by `Smarkets <https://smarkets.com/>`_.
14098
14099 .. _v3.38.9:
14100
14101 -------------------
14102 3.38.9 - 2017-11-29
14103 -------------------
14104
14105 This is a documentation release to improve the documentation of shrinking
14106 behaviour for Hypothesis's strategies.
14107
14108 .. _v3.38.8:
14109
14110 -------------------
14111 3.38.8 - 2017-11-29
14112 -------------------
14113
14114 This release improves the performance of
14115 :func:`~hypothesis.strategies.characters` when using ``exclude_characters``
14116 and :func:`~hypothesis.strategies.from_regex` when using negative character
14117 classes.
14118
14119 The problems this fixes were found in the course of work funded by
14120 `Smarkets <https://smarkets.com/>`_.
14121
14122 .. _v3.38.7:
14123
14124 -------------------
14125 3.38.7 - 2017-11-29
14126 -------------------
14127
14128 This is a patch release for :func:`~hypothesis.strategies.from_regex`, which
14129 had a bug in handling of the :obj:`python:re.VERBOSE` flag (:issue:`992`).
14130 Flags are now handled correctly when parsing regex.
14131
14132 .. _v3.38.6:
14133
14134 -------------------
14135 3.38.6 - 2017-11-28
14136 -------------------
14137
14138 This patch changes a few byte-string literals from double to single quotes,
14139 thanks to an update in :pypi:`unify`. There are no user-visible changes.
14140
14141 .. _v3.38.5:
14142
14143 -------------------
14144 3.38.5 - 2017-11-23
14145 -------------------
14146
14147 This fixes the repr of strategies using lambda that are defined inside
14148 decorators to include the lambda source.
14149
14150 This would mostly have been visible when using the
14151 :ref:`statistics <statistics>` functionality - lambdas used for e.g. filtering
14152 would have shown up with a ``<unknown>`` as their body. This can still happen,
14153 but it should happen less often now.
14154
14155 .. _v3.38.4:
14156
14157 -------------------
14158 3.38.4 - 2017-11-22
14159 -------------------
14160
14161 This release updates the reported :ref:`statistics <statistics>` so that they
14162 show approximately what fraction of your test run time is spent in data
14163 generation (as opposed to test execution).
14164
14165 This work was funded by `Smarkets <https://smarkets.com/>`_.
14166
14167 .. _v3.38.3:
14168
14169 -------------------
14170 3.38.3 - 2017-11-21
14171 -------------------
14172
14173 This is a documentation release, which ensures code examples are up to date
14174 by running them as doctests in CI (:issue:`711`).
14175
14176 .. _v3.38.2:
14177
14178 -------------------
14179 3.38.2 - 2017-11-21
14180 -------------------
14181
14182 This release changes the behaviour of the :attr:`~hypothesis.settings.deadline`
14183 setting when used with :func:`~hypothesis.strategies.data`: Time spent inside
14184 calls to ``data.draw`` will no longer be counted towards the deadline time.
14185
14186 As a side effect of some refactoring required for this work, the way flaky
14187 tests are handled has changed slightly. You are unlikely to see much difference
14188 from this, but some error messages will have changed.
14189
14190 This work was funded by `Smarkets <https://smarkets.com/>`_.
14191
14192 .. _v3.38.1:
14193
14194 -------------------
14195 3.38.1 - 2017-11-21
14196 -------------------
14197
14198 This patch has a variety of non-user-visible refactorings, removing various
14199 minor warts ranging from indirect imports to typos in comments.
14200
14201 .. _v3.38.0:
14202
14203 -------------------
14204 3.38.0 - 2017-11-18
14205 -------------------
14206
14207 This release overhauls the |HealthCheck| system
14208 in a variety of small ways.
14209 It adds no new features, but is nevertheless a minor release because it changes
14210 which tests are likely to fail health checks.
14211
14212 The most noticeable effect is that some tests that used to fail health checks
14213 will now pass, and some that used to pass will fail. These should all be
14214 improvements in accuracy. In particular:
14215
14216 * New failures will usually be because they are now taking into account things
14217 like use of :func:`~hypothesis.strategies.data` and
14218 :func:`~hypothesis.assume` inside the test body.
14219 * New failures *may* also be because for some classes of example the way data
14220 generation performance was measured was artificially faster than real data
14221 generation (for most examples that are hitting performance health checks the
14222 opposite should be the case).
14223 * Tests that used to fail health checks and now pass do so because the health
14224 check system used to run in a way that was subtly different than the main
14225 Hypothesis data generation and lacked some of its support for e.g. large
14226 examples.
14227
14228 If your data generation is especially slow, you may also see your tests get
14229 somewhat faster, as there is no longer a separate health check phase. This will
14230 be particularly noticeable when rerunning test failures.
14231
14232 This work was funded by `Smarkets <https://smarkets.com/>`_.
14233
14234 .. _v3.37.0:
14235
14236 -------------------
14237 3.37.0 - 2017-11-12
14238 -------------------
14239
14240 This is a deprecation release for some health check related features.
14241
14242 The following are now deprecated:
14243
14244 * Passing ``HealthCheck.exception_in_generation`` to
14245 :attr:`~hypothesis.settings.suppress_health_check`. This no longer does
14246 anything even when passed - All errors that occur during data generation
14247 will now be immediately reraised rather than going through the health check
14248 mechanism.
14249 * Passing ``HealthCheck.random_module`` to
14250 :attr:`~hypothesis.settings.suppress_health_check`. This hasn't done anything
14251 for a long time, but was never explicitly deprecated. Hypothesis always seeds
14252 the random module when running :func:`@given <hypothesis.given>` tests, so this
14253 is no longer an error and suppressing it doesn't do anything.
14254 * Passing non-:class:`~hypothesis.HealthCheck` values in
14255 :attr:`~hypothesis.settings.suppress_health_check`. This was previously
14256 allowed but never did anything useful.
14257
14258 In addition, passing a non-iterable value as :attr:`~hypothesis.settings.suppress_health_check`
14259 will now raise an error immediately (it would never have worked correctly, but
14260 it would previously have failed later). Some validation error messages have
14261 also been updated.
14262
14263 This work was funded by `Smarkets <https://smarkets.com/>`_.
14264
14265 .. _v3.36.1:
14266
14267 -------------------
14268 3.36.1 - 2017-11-10
14269 -------------------
14270
14271 This is a yak shaving release, mostly concerned with our own tests.
14272
14273 While :func:`~python:inspect.getfullargspec` was documented as deprecated
14274 in Python 3.5, it never actually emitted a warning. Our code to silence
14275 this (nonexistent) warning has therefore been removed.
14276
14277 We now run our tests with ``DeprecationWarning`` as an error, and made some
14278 minor changes to our own tests as a result. This required similar upstream
14279 updates to :pypi:`coverage` and :pypi:`execnet` (a test-time dependency via
14280 :pypi:`pytest-xdist`).
14281
14282 There is no user-visible change in Hypothesis itself, but we encourage you
14283 to consider enabling deprecations as errors in your own tests.
14284
14285 .. _v3.36.0:
14286
14287 -------------------
14288 3.36.0 - 2017-11-06
14289 -------------------
14290
14291 This release adds a setting to the public API, and does some internal cleanup:
14292
14293 - The :attr:`~hypothesis.settings.derandomize` setting is now documented (:issue:`890`)
14294 - Removed - and disallowed - all 'bare excepts' in Hypothesis (:issue:`953`)
14295 - Documented the ``strict`` setting as deprecated, and
14296 updated the build so our docs always match deprecations in the code.
14297
14298 .. _v3.35.0:
14299
14300 -------------------
14301 3.35.0 - 2017-11-06
14302 -------------------
14303
14304 This minor release supports constraining :func:`~hypothesis.strategies.uuids`
14305 to generate a particular version of :class:`~python:uuid.UUID` (:issue:`721`).
14306
14307 Thanks to Dion Misic for this feature.
14308
14309 .. _v3.34.1:
14310
14311 -------------------
14312 3.34.1 - 2017-11-02
14313 -------------------
14314
14315 This patch updates the documentation to suggest
14316 :func:`builds(callable) <hypothesis.strategies.builds>` instead of
14317 :func:`just(callable()) <hypothesis.strategies.just>`.
14318
14319 .. _v3.34.0:
14320
14321 -------------------
14322 3.34.0 - 2017-11-02
14323 -------------------
14324
14325 Hypothesis now emits deprecation warnings if you apply
14326 :func:`@given <hypothesis.given>` more than once to a target.
14327
14328 Applying :func:`@given <hypothesis.given>` repeatedly wraps the target multiple
14329 times. Each wrapper will search the space of possible parameters separately.
14330 This is equivalent but will be much more inefficient than doing it with a
14331 single call to :func:`@given <hypothesis.given>`.
14332
14333 For example, instead of
14334 ``@given(booleans()) @given(integers())``, you could write
14335 ``@given(booleans(), integers())``
14336
14337 .. _v3.33.1:
14338
14339 -------------------
14340 3.33.1 - 2017-11-02
14341 -------------------
14342
14343 This is a bugfix release:
14344
14345 - :func:`~hypothesis.strategies.builds` would try to infer a strategy for
14346 required positional arguments of the target from type hints, even if they
14347 had been given to :func:`~hypothesis.strategies.builds` as positional
14348 arguments (:issue:`946`). Now it only infers missing required arguments.
14349 - An internal introspection function wrongly reported ``self`` as a required
14350 argument for bound methods, which might also have affected
14351 :func:`~hypothesis.strategies.builds`. Now it knows better.
14352
14353 .. _v3.33.0:
14354
14355 -------------------
14356 3.33.0 - 2017-10-16
14357 -------------------
14358
14359 This release supports strategy inference for more Django field types - you can now omit an argument for
14360 Date, Time, Duration, Slug, IP Address, and UUID fields. (:issue:`642`)
14361
14362 Strategy generation for fields with grouped choices now selects choices from
14363 each group, instead of selecting from the group names.
14364
14365 .. _v3.32.2:
14366
14367 -------------------
14368 3.32.2 - 2017-10-15
14369 -------------------
14370
14371 This patch removes the ``mergedb`` tool, introduced in Hypothesis 1.7.1
14372 on an experimental basis. It has never actually worked, and the new
14373 :ref:`Hypothesis example database <database>` is designed to make such a
14374 tool unnecessary.
14375
14376 .. _v3.32.1:
14377
14378 -------------------
14379 3.32.1 - 2017-10-13
14380 -------------------
14381
14382 This patch has two improvements for strategies based on enumerations.
14383
14384 - :func:`~hypothesis.strategies.from_type` now handles enumerations correctly,
14385 delegating to :func:`~hypothesis.strategies.sampled_from`. Previously it
14386 noted that ``Enum.__init__`` has no required arguments and therefore delegated
14387 to :func:`~hypothesis.strategies.builds`, which would subsequently fail.
14388 - When sampling from an :class:`python:enum.Flag`, we also generate combinations
14389 of members. Eg for ``Flag('Permissions', 'READ, WRITE, EXECUTE')`` we can now
14390 generate, ``Permissions.READ``, ``Permissions.READ|WRITE``, and so on.
14391
14392 .. _v3.32.0:
14393
14394 -------------------
14395 3.32.0 - 2017-10-09
14396 -------------------
14397
14398 This changes the default value of
14399 the ``use_coverage`` setting to True when
14400 running on pypy (it was already True on CPython).
14401
14402 It was previously set to False because we expected it to be too slow, but
14403 recent benchmarking shows that actually performance of the feature on pypy is
14404 fairly acceptable - sometimes it's slower than on CPython, sometimes it's
14405 faster, but it's generally within a factor of two either way.
14406
14407 .. _v3.31.6:
14408
14409 -------------------
14410 3.31.6 - 2017-10-08
14411 -------------------
14412
14413 This patch improves the quality of strategies inferred from Numpy dtypes:
14414
14415 * Integer dtypes generated examples with the upper half of their (non-sign) bits
14416 set to zero. The inferred strategies can now produce any representable integer.
14417 * Fixed-width unicode- and byte-string dtypes now cap the internal example
14418 length, which should improve example and shrink quality.
14419 * Numpy arrays can only store fixed-size strings internally, and allow shorter
14420 strings by right-padding them with null bytes. Inferred string strategies
14421 no longer generate such values, as they can never be retrieved from an array.
14422 This improves shrinking performance by skipping useless values.
14423
14424 This has already been useful in Hypothesis - we found an overflow bug in our
14425 Pandas support, and as a result :func:`~hypothesis.extra.pandas.indexes` and
14426 :func:`~hypothesis.extra.pandas.range_indexes` now check that ``min_size``
14427 and ``max_size`` are at least zero.
14428
14429 .. _v3.31.5:
14430
14431 -------------------
14432 3.31.5 - 2017-10-08
14433 -------------------
14434
14435 This release fixes a performance problem in tests where
14436 the ``use_coverage`` setting is True.
14437
14438 Tests experience a slow-down proportionate to the amount of code they cover.
14439 This is still the case, but the factor is now low enough that it should be
14440 unnoticeable. Previously it was large and became much larger in :ref:`3.30.4 <v3.30.4>`.
14441
14442 .. _v3.31.4:
14443
14444 -------------------
14445 3.31.4 - 2017-10-08
14446 -------------------
14447
14448 :func:`~hypothesis.strategies.from_type` failed with a very confusing error
14449 if passed a :obj:`~typing.NewType` (:issue:`901`). These pseudo-types
14450 are now unwrapped correctly, and strategy inference works as expected.
14451
14452 .. _v3.31.3:
14453
14454 -------------------
14455 3.31.3 - 2017-10-06
14456 -------------------
14457
14458 This release makes some small optimisations to our use of coverage that should
14459 reduce constant per-example overhead. This is probably only noticeable on
14460 examples where the test itself is quite fast. On no-op tests that don't test
14461 anything you may see up to a fourfold speed increase (which is still
14462 significantly slower than without coverage). On more realistic tests the speed
14463 up is likely to be less than that.
14464
14465 .. _v3.31.2:
14466
14467 -------------------
14468 3.31.2 - 2017-09-30
14469 -------------------
14470
14471 This release fixes some formatting and small typos/grammar issues in the
14472 documentation, specifically the page docs/settings.rst, and the inline docs
14473 for the various settings.
14474
14475 .. _v3.31.1:
14476
14477 -------------------
14478 3.31.1 - 2017-09-30
14479 -------------------
14480
14481 This release improves the handling of deadlines so that they act better with
14482 the shrinking process. This fixes :issue:`892`.
14483
14484 This involves two changes:
14485
14486 1. The deadline is raised during the initial generation and shrinking, and then
14487 lowered to the set value for final replay. This restricts our attention to
14488 examples which exceed the deadline by a more significant margin, which
14489 increases their reliability.
14490 2. When despite the above a test still becomes flaky because it is
14491 significantly faster on rerun than it was on its first run, the error
14492 message is now more explicit about the nature of this problem, and includes
14493 both the initial test run time and the new test run time.
14494
14495 In addition, this release also clarifies the documentation of the deadline
14496 setting slightly to be more explicit about where it applies.
14497
14498 This work was funded by `Smarkets <https://smarkets.com/>`_.
14499
14500 .. _v3.31.0:
14501
14502 -------------------
14503 3.31.0 - 2017-09-29
14504 -------------------
14505
14506 This release blocks installation of Hypothesis on Python 3.3, which
14507 :PEP:`reached its end of life date on 2017-09-29 <398>`.
14508
14509 This should not be of interest to anyone but downstream maintainers -
14510 if you are affected, migrate to a secure version of Python as soon as
14511 possible or at least seek commercial support.
14512
14513 .. _v3.30.4:
14514
14515 -------------------
14516 3.30.4 - 2017-09-27
14517 -------------------
14518
14519 This release makes several changes:
14520
14521 1. It significantly improves Hypothesis's ability to use coverage information
14522 to find interesting examples.
14523 2. It reduces the default :attr:`~hypothesis.settings.max_examples` setting from 200 to 100. This takes
14524 advantage of the improved algorithm meaning fewer examples are typically
14525 needed to get the same testing and is sufficiently better at covering
14526 interesting behaviour, and offsets some of the performance problems of
14527 running under coverage.
14528 3. Hypothesis will always try to start its testing with an example that is near
14529 minimized.
14530
14531 The new algorithm for 1 also makes some changes to Hypothesis's low level data
14532 generation which apply even with coverage turned off. They generally reduce the
14533 total amount of data generated, which should improve test performance somewhat.
14534 Between this and 3 you should see a noticeable reduction in test runtime (how
14535 much so depends on your tests and how much example size affects their
14536 performance. On our benchmarks, where data generation dominates, we saw up to
14537 a factor of two performance improvement, but it's unlikely to be that large.
14538
14539 .. _v3.30.3:
14540
14541 -------------------
14542 3.30.3 - 2017-09-25
14543 -------------------
14544
14545 This release fixes some formatting and small typos/grammar issues in the
14546 documentation, specifically the page docs/details.rst, and some inline
14547 docs linked from there.
14548
14549 .. _v3.30.2:
14550
14551 -------------------
14552 3.30.2 - 2017-09-24
14553 -------------------
14554
14555 This release changes Hypothesis's caching approach for functions in
14556 ``hypothesis.strategies``. Previously it would have cached extremely
14557 aggressively and cache entries would never be evicted. Now it adopts a
14558 least-frequently used, least recently used key invalidation policy, and is
14559 somewhat more conservative about which strategies it caches.
14560
14561 Workloads which create strategies based on dynamic values, e.g. by using
14562 |.flatmap| or :func:`~hypothesis.strategies.composite`,
14563 will use significantly less memory.
14564
14565 .. _v3.30.1:
14566
14567 -------------------
14568 3.30.1 - 2017-09-22
14569 -------------------
14570
14571 This release fixes a bug where when running with
14572 the ``use_coverage=True`` setting inside an
14573 existing running instance of coverage, Hypothesis would frequently put files
14574 that the coveragerc excluded in the report for the enclosing coverage.
14575
14576 .. _v3.30.0:
14577
14578 -------------------
14579 3.30.0 - 2017-09-20
14580 -------------------
14581
14582 This release introduces two new features:
14583
14584 * When a test fails, either with a health check failure or a falsifying example,
14585 Hypothesis will print out a seed that led to that failure, if the test is not
14586 already running with a fixed seed. You can then recreate that failure using either
14587 the :func:`@seed <hypothesis.seed>` decorator or (if you are running pytest) with ``--hypothesis-seed``.
14588 * :pypi:`pytest` users can specify a seed to use for :func:`@given <hypothesis.given>` based tests by passing
14589 the ``--hypothesis-seed`` command line argument.
14590
14591 This work was funded by `Smarkets <https://smarkets.com/>`_.
14592
14593 .. _v3.29.0:
14594
14595 -------------------
14596 3.29.0 - 2017-09-19
14597 -------------------
14598
14599 This release makes Hypothesis coverage aware. Hypothesis now runs all test
14600 bodies under coverage, and uses this information to guide its testing.
14601
14602 The ``use_coverage`` setting can be used to disable
14603 this behaviour if you want to test code that is sensitive to coverage being
14604 enabled (either because of performance or interaction with the trace function).
14605
14606 The main benefits of this feature are:
14607
14608 * Hypothesis now observes when examples it discovers cover particular lines
14609 or branches and stores them in the database for later.
14610 * Hypothesis will make some use of this information to guide its exploration of
14611 the search space and improve the examples it finds (this is currently used
14612 only very lightly and will likely improve significantly in future releases).
14613
14614 This also has the following side-effects:
14615
14616 * Hypothesis now has an install time dependency on the :pypi:`coverage` package.
14617 * Tests that are already running Hypothesis under coverage will likely get
14618 faster.
14619 * Tests that are not running under coverage now run their test bodies under
14620 coverage by default.
14621
14622
14623 This feature is only partially supported under pypy. It is significantly slower
14624 than on CPython and is turned off by default as a result, but it should still
14625 work correctly if you want to use it.
14626
14627 .. _v3.28.3:
14628
14629 -------------------
14630 3.28.3 - 2017-09-18
14631 -------------------
14632
14633 This release is an internal change that affects how Hypothesis handles
14634 calculating certain properties of strategies.
14635
14636 The primary effect of this is that it fixes a bug where use of
14637 :func:`~hypothesis.strategies.deferred` could sometimes trigger an internal assertion
14638 error. However the fix for this bug involved some moderately deep changes to
14639 how Hypothesis handles certain constructs so you may notice some additional
14640 knock-on effects.
14641
14642 In particular the way Hypothesis handles drawing data from strategies that
14643 cannot generate any values has changed to bail out sooner than it previously
14644 did. This may speed up certain tests, but it is unlikely to make much of a
14645 difference in practice for tests that were not already failing with
14646 Unsatisfiable.
14647
14648 .. _v3.28.2:
14649
14650 -------------------
14651 3.28.2 - 2017-09-18
14652 -------------------
14653
14654 This is a patch release that fixes a bug in the :mod:`hypothesis.extra.pandas`
14655 documentation where it incorrectly referred to :func:`~hypothesis.extra.pandas.column`
14656 instead of :func:`~hypothesis.extra.pandas.columns`.
14657
14658 .. _v3.28.1:
14659
14660 -------------------
14661 3.28.1 - 2017-09-16
14662 -------------------
14663
14664 This is a refactoring release. It moves a number of internal uses
14665 of :func:`~python:collections.namedtuple` over to using attrs based classes, and removes a couple
14666 of internal namedtuple classes that were no longer in use.
14667
14668 It should have no user visible impact.
14669
14670 .. _v3.28.0:
14671
14672 -------------------
14673 3.28.0 - 2017-09-15
14674 -------------------
14675
14676 This release adds support for testing :pypi:`pandas` via the :ref:`hypothesis.extra.pandas <hypothesis-pandas>`
14677 module.
14678
14679 It also adds a dependency on :pypi:`attrs`.
14680
14681 This work was funded by `Stripe <https://stripe.com/>`_.
14682
14683 .. _v3.27.1:
14684
14685 -------------------
14686 3.27.1 - 2017-09-14
14687 -------------------
14688
14689 This release fixes some formatting and broken cross-references in the
14690 documentation, which includes editing docstrings - and thus a patch release.
14691
14692 .. _v3.27.0:
14693
14694 -------------------
14695 3.27.0 - 2017-09-13
14696 -------------------
14697
14698 This release introduces a :attr:`~hypothesis.settings.deadline`
14699 setting to Hypothesis.
14700
14701 When set this turns slow tests into errors. By default it is unset but will
14702 warn if you exceed 200ms, which will become the default value in a future
14703 release.
14704
14705 This work was funded by `Smarkets <https://smarkets.com/>`_.
14706
14707 .. _v3.26.0:
14708
14709 -------------------
14710 3.26.0 - 2017-09-12
14711 -------------------
14712
14713 Hypothesis now emits deprecation warnings if you are using the legacy
14714 SQLite example database format, or the tool for merging them. These were
14715 already documented as deprecated, so this doesn't change their deprecation
14716 status, only that we warn about it.
14717
14718 .. _v3.25.1:
14719
14720 -------------------
14721 3.25.1 - 2017-09-12
14722 -------------------
14723
14724 This release fixes a bug with generating :doc:`numpy datetime and timedelta types <numpy:reference/arrays.datetime>`:
14725 When inferring the strategy from the dtype, datetime and timedelta dtypes with
14726 sub-second precision would always produce examples with one second resolution.
14727 Inferring a strategy from a time dtype will now always produce example with the
14728 same precision.
14729
14730 .. _v3.25.0:
14731
14732 -------------------
14733 3.25.0 - 2017-09-12
14734 -------------------
14735
14736 This release changes how Hypothesis shrinks and replays examples to take into
14737 account that it can encounter new bugs while shrinking the bug it originally
14738 found. Previously it would end up replacing the originally found bug with the
14739 new bug and show you only that one. Now it is (often) able to recognise when
14740 two bugs are distinct and when it finds more than one will show both.
14741
14742 .. _v3.24.2:
14743
14744 -------------------
14745 3.24.2 - 2017-09-11
14746 -------------------
14747
14748 This release removes the (purely internal and no longer useful)
14749 ``strategy_test_suite`` function and the corresponding strategytests module.
14750
14751 .. _v3.24.1:
14752
14753 -------------------
14754 3.24.1 - 2017-09-06
14755 -------------------
14756
14757 This release improves the reduction of examples involving floating point
14758 numbers to produce more human readable examples.
14759
14760 It also has some general purpose changes to the way the minimizer works
14761 internally, which may see some improvement in quality and slow down of test
14762 case reduction in cases that have nothing to do with floating point numbers.
14763
14764 .. _v3.24.0:
14765
14766 -------------------
14767 3.24.0 - 2017-09-05
14768 -------------------
14769
14770 Hypothesis now emits deprecation warnings if you use ``some_strategy.example()`` inside a
14771 test function or strategy definition (this was never intended to be supported,
14772 but is sufficiently widespread that it warrants a deprecation path).
14773
14774 .. _v3.23.3:
14775
14776 -------------------
14777 3.23.3 - 2017-09-05
14778 -------------------
14779
14780 This is a bugfix release for :func:`~hypothesis.strategies.decimals`
14781 with the ``places`` argument.
14782
14783 - No longer fails health checks (:issue:`725`, due to internal filtering)
14784 - Specifying a ``min_value`` and ``max_value`` without any decimals with
14785 ``places`` places between them gives a more useful error message.
14786 - Works for any valid arguments, regardless of the decimal precision context.
14787
14788 .. _v3.23.2:
14789
14790 -------------------
14791 3.23.2 - 2017-09-01
14792 -------------------
14793
14794 This is a small refactoring release that removes a now-unused parameter to an
14795 internal API. It shouldn't have any user visible effect.
14796
14797 .. _v3.23.1:
14798
14799 -------------------
14800 3.23.1 - 2017-09-01
14801 -------------------
14802
14803 Hypothesis no longer propagates the dynamic scope of settings into strategy
14804 definitions.
14805
14806 This release is a small change to something that was never part of the public
14807 API and you will almost certainly not notice any effect unless you're doing
14808 something surprising, but for example the following code will now give a
14809 different answer in some circumstances:
14810
14811 .. code-block:: python
14812
14813 import hypothesis.strategies as st
14814 from hypothesis import settings
14815
14816 CURRENT_SETTINGS = st.builds(lambda: settings.default)
14817
14818 (We don't actually encourage you writing code like this)
14819
14820 Previously this would have generated the settings that were in effect at the
14821 point of definition of ``CURRENT_SETTINGS``. Now it will generate the settings
14822 that are used for the current test.
14823
14824 It is very unlikely to be significant enough to be visible, but you may also
14825 notice a small performance improvement.
14826
14827 .. _v3.23.0:
14828
14829 -------------------
14830 3.23.0 - 2017-08-31
14831 -------------------
14832
14833 This release adds a ``unique`` argument to :func:`~hypothesis.extra.numpy.arrays`
14834 which behaves the same ways as the corresponding one for
14835 :func:`~hypothesis.strategies.lists`, requiring all of the elements in the
14836 generated array to be distinct.
14837
14838 .. _v3.22.2:
14839
14840 -------------------
14841 3.22.2 - 2017-08-29
14842 -------------------
14843
14844 This release fixes an issue where Hypothesis would raise a ``TypeError`` when
14845 using the datetime-related strategies if running with ``PYTHONOPTIMIZE=2``.
14846 This bug was introduced in :ref:`3.20.0 <v3.20.0>`. (See :issue:`822`)
14847
14848 .. _v3.22.1:
14849
14850 -------------------
14851 3.22.1 - 2017-08-28
14852 -------------------
14853
14854 Hypothesis now transparently handles problems with an internal unicode cache,
14855 including file truncation or read-only filesystems (:issue:`767`).
14856 Thanks to Sam Hames for the patch.
14857
14858 .. _v3.22.0:
14859
14860 -------------------
14861 3.22.0 - 2017-08-26
14862 -------------------
14863
14864 This release provides what should be a substantial performance improvement to
14865 numpy arrays generated using :ref:`provided numpy support <hypothesis-numpy>`,
14866 and adds a new ``fill_value`` argument to :func:`~hypothesis.extra.numpy.arrays`
14867 to control this behaviour.
14868
14869 This work was funded by `Stripe <https://stripe.com/>`_.
14870
14871 .. _v3.21.3:
14872
14873 -------------------
14874 3.21.3 - 2017-08-26
14875 -------------------
14876
14877 This release fixes some extremely specific circumstances that probably have
14878 never occurred in the wild where users of
14879 :func:`~hypothesis.strategies.deferred` might have seen a :class:`python:RuntimeError` from
14880 too much recursion, usually in cases where no valid example could have been
14881 generated anyway.
14882
14883 .. _v3.21.2:
14884
14885 -------------------
14886 3.21.2 - 2017-08-25
14887 -------------------
14888
14889 This release fixes some minor bugs in argument validation:
14890
14891 * :ref:`hypothesis.extra.numpy <hypothesis-numpy>` dtype strategies would raise an internal error
14892 instead of an InvalidArgument exception when passed an invalid
14893 endianness specification.
14894 * :func:`~hypothesis.strategies.fractions` would raise an internal error instead of an InvalidArgument
14895 if passed ``float("nan")`` as one of its bounds.
14896 * The error message for passing ``float("nan")`` as a bound to various
14897 strategies has been improved.
14898 * Various bound arguments will now raise InvalidArgument in cases where
14899 they would previously have raised an internal TypeError or
14900 ValueError from the relevant conversion function.
14901 * ``streaming()`` would not have emitted a
14902 deprecation warning when called with an invalid argument.
14903
14904 .. _v3.21.1:
14905
14906 -------------------
14907 3.21.1 - 2017-08-24
14908 -------------------
14909
14910 This release fixes a bug where test failures that were the result of
14911 an :obj:`@example <hypothesis.example>` would print an extra stack trace before re-raising the
14912 exception.
14913
14914 .. _v3.21.0:
14915
14916 -------------------
14917 3.21.0 - 2017-08-23
14918 -------------------
14919
14920 This release deprecates Hypothesis's strict mode, which turned Hypothesis's
14921 deprecation warnings into errors. Similar functionality can be achieved
14922 by using :func:`simplefilter('error', HypothesisDeprecationWarning) <python:warnings.simplefilter>`.
14923
14924 .. _v3.20.0:
14925
14926 -------------------
14927 3.20.0 - 2017-08-22
14928 -------------------
14929
14930 This release renames the relevant arguments on the
14931 :func:`~hypothesis.strategies.datetimes`, :func:`~hypothesis.strategies.dates`,
14932 :func:`~hypothesis.strategies.times`, and :func:`~hypothesis.strategies.timedeltas`
14933 strategies to ``min_value`` and ``max_value``, to make them consistent with the
14934 other strategies in the module.
14935
14936 The old argument names are still supported but will emit a deprecation warning
14937 when used explicitly as keyword arguments. Arguments passed positionally will
14938 go to the new argument names and are not deprecated.
14939
14940 .. _v3.19.3:
14941
14942 -------------------
14943 3.19.3 - 2017-08-22
14944 -------------------
14945
14946 This release provides a major overhaul to the internals of how Hypothesis
14947 handles shrinking.
14948
14949 This should mostly be visible in terms of getting better examples for tests
14950 which make heavy use of :func:`~hypothesis.strategies.composite`,
14951 :func:`~hypothesis.strategies.data` or |.flatmap| where the data
14952 drawn depends a lot on previous choices, especially where size parameters are
14953 affected. Previously Hypothesis would have struggled to reliably produce
14954 good examples here. Now it should do much better. Performance should also be
14955 better for examples with a non-zero ``min_size``.
14956
14957 You may see slight changes to example generation (e.g. improved example
14958 diversity) as a result of related changes to internals, but they are unlikely
14959 to be significant enough to notice.
14960
14961 .. _v3.19.2:
14962
14963 -------------------
14964 3.19.2 - 2017-08-21
14965 -------------------
14966
14967 This release fixes two bugs in :mod:`hypothesis.extra.numpy`:
14968
14969 * :func:`~hypothesis.extra.numpy.unicode_string_dtypes` didn't work at all due
14970 to an incorrect dtype specifier. Now it does.
14971 * Various impossible conditions would have been accepted but would error when
14972 they fail to produced any example. Now they raise an explicit InvalidArgument
14973 error.
14974
14975 .. _v3.19.1:
14976
14977 -------------------
14978 3.19.1 - 2017-08-21
14979 -------------------
14980
14981 This is a bugfix release for :issue:`739`, where bounds for
14982 :func:`~hypothesis.strategies.fractions` or floating-point
14983 :func:`~hypothesis.strategies.decimals` were not properly converted to
14984 integers before passing them to the integers strategy.
14985 This excluded some values that should have been possible, and could
14986 trigger internal errors if the bounds lay between adjacent integers.
14987
14988 You can now bound :func:`~hypothesis.strategies.fractions` with two
14989 arbitrarily close fractions.
14990
14991 It is now an explicit error to supply a min_value, max_value, and
14992 max_denominator to :func:`~hypothesis.strategies.fractions` where the value
14993 bounds do not include a fraction with denominator at most max_denominator.
14994
14995 .. _v3.19.0:
14996
14997 -------------------
14998 3.19.0 - 2017-08-20
14999 -------------------
15000
15001 This release adds the :func:`~hypothesis.strategies.from_regex` strategy,
15002 which generates strings that contain a match of a regular expression.
15003
15004 Thanks to Maxim Kulkin for creating the
15005 `hypothesis-regex <https://github.com/maximkulkin/hypothesis-regex>`_
15006 package and then helping to upstream it! (:issue:`662`)
15007
15008 .. _v3.18.5:
15009
15010 -------------------
15011 3.18.5 - 2017-08-18
15012 -------------------
15013
15014 This is a bugfix release for :func:`~hypothesis.strategies.integers`.
15015 Previously the strategy would hit an internal assertion if passed non-integer
15016 bounds for ``min_value`` and ``max_value`` that had no integers between them.
15017 The strategy now raises InvalidArgument instead.
15018
15019 .. _v3.18.4:
15020
15021 -------------------
15022 3.18.4 - 2017-08-18
15023 -------------------
15024
15025 Release to fix a bug where mocks can be used as test runners under certain
15026 conditions. Specifically, if a mock is injected into a test via pytest
15027 fixtures or patch decorators, and that mock is the first argument in the
15028 list, hypothesis will think it represents self and turns the mock
15029 into a test runner. If this happens, the affected test always passes
15030 because the mock is executed instead of the test body. Sometimes, it
15031 will also fail health checks.
15032
15033 Fixes :issue:`491` and a section of :issue:`198`.
15034 Thanks to Ben Peterson for this bug fix.
15035
15036 .. _v3.18.3:
15037
15038 -------------------
15039 3.18.3 - 2017-08-17
15040 -------------------
15041
15042 This release should improve the performance of some tests which
15043 experienced a slow down as a result of the :ref:`3.13.0 <v3.13.0>` release.
15044
15045 Tests most likely to benefit from this are ones that make extensive
15046 use of ``min_size`` parameters, but others may see some improvement
15047 as well.
15048
15049 .. _v3.18.2:
15050
15051 -------------------
15052 3.18.2 - 2017-08-16
15053 -------------------
15054
15055 This release fixes a bug introduced in :ref:`3.18.0 <v3.18.0>`. If the arguments
15056 ``include_characters`` and ``exclude_characters`` to
15057 :func:`~hypothesis.strategies.characters` contained overlapping elements, then an
15058 ``InvalidArgument`` exception would be raised.
15059
15060 Thanks to Zac Hatfield-Dodds for reporting and fixing this.
15061
15062 .. _v3.18.1:
15063
15064 -------------------
15065 3.18.1 - 2017-08-14
15066 -------------------
15067
15068 This is a bug fix release to fix :issue:`780`, where
15069 :func:`~hypothesis.strategies.sets` and similar would trigger health check
15070 errors if their element strategy could only produce one element (e.g.
15071 if it was :func:`~hypothesis.strategies.just`).
15072
15073 .. _v3.18.0:
15074
15075 -------------------
15076 3.18.0 - 2017-08-13
15077 -------------------
15078
15079 This is a feature release:
15080
15081 * :func:`~hypothesis.strategies.characters` now accepts
15082 ``include_characters``, particular characters which will be added to those
15083 it produces. (:issue:`668`)
15084 * A bug fix for the internal function ``_union_interval_lists()``, and a rename
15085 to ``_union_intervals()``. It now correctly handles all cases where intervals
15086 overlap, and it always returns the result as a tuple for tuples.
15087
15088 Thanks to Alex Willmer for these.
15089
15090 .. _v3.17.0:
15091
15092 -------------------
15093 3.17.0 - 2017-08-07
15094 -------------------
15095
15096 This release documents the previously undocumented phases feature in |Phase|,
15097 making it part of the public API. It also updates how the example
15098 database is used. Principally:
15099
15100 * The :obj:`~hypothesis.Phase.reuse` phase will now correctly control whether examples
15101 from the database are run (it previously did exactly the wrong thing and
15102 controlled whether examples would be *saved*).
15103 * Hypothesis will no longer try to rerun *all* previously failing examples.
15104 Instead it will replay the smallest previously failing example and a
15105 selection of other examples that are likely to trigger any other bugs that
15106 will found. This prevents a previous failure from dominating your tests
15107 unnecessarily.
15108 * As a result of the previous change, Hypothesis will be slower about clearing
15109 out old examples from the database that are no longer failing (because it can
15110 only clear out ones that it actually runs).
15111
15112 .. _v3.16.1:
15113
15114 -------------------
15115 3.16.1 - 2017-08-07
15116 -------------------
15117
15118 This release makes an implementation change to how Hypothesis handles certain
15119 internal constructs.
15120
15121 The main effect you should see is improvement to the behaviour and performance
15122 of collection types, especially ones with a ``min_size`` parameter. Many cases
15123 that would previously fail due to being unable to generate enough valid
15124 examples will now succeed, and other cases should run slightly faster.
15125
15126 .. _v3.16.0:
15127
15128 -------------------
15129 3.16.0 - 2017-08-04
15130 -------------------
15131
15132 This release introduces a deprecation of the timeout feature. This results in
15133 the following changes:
15134
15135 * Creating a settings object with an explicit timeout will emit a deprecation
15136 warning.
15137 * If your test stops because it hits the timeout (and has not found a bug) then
15138 it will emit a deprecation warning.
15139 * There is a new value ``unlimited`` which you can import from hypothesis.
15140 ``settings(timeout=unlimited)`` will *not* cause a deprecation warning.
15141 * There is a new health check, ``hung_test``, which will trigger after a test
15142 has been running for five minutes if it is not suppressed.
15143
15144 .. _v3.15.0:
15145
15146 -------------------
15147 3.15.0 - 2017-08-04
15148 -------------------
15149
15150 This release deprecates two strategies, ``choices()`` and ``streaming()``.
15151
15152 Both of these are somewhat confusing to use and are entirely redundant since the
15153 introduction of the :func:`~hypothesis.strategies.data` strategy for interactive
15154 drawing in tests, and their use should be replaced with direct use of
15155 :func:`~hypothesis.strategies.data` instead.
15156
15157 .. _v3.14.2:
15158
15159 -------------------
15160 3.14.2 - 2017-08-03
15161 -------------------
15162
15163 This fixes a bug where Hypothesis would not work correctly on Python 2.7 if you
15164 had the :mod:`python:typing` module :pypi:`backport <typing>` installed.
15165
15166 .. _v3.14.1:
15167
15168 -------------------
15169 3.14.1 - 2017-08-02
15170 -------------------
15171
15172 This raises the maximum depth at which Hypothesis starts cutting off data
15173 generation to a more reasonable value which it is harder to hit by accident.
15174
15175 This resolves (:issue:`751`), in which some examples which previously worked
15176 would start timing out, but it will also likely improve the data generation
15177 quality for complex data types.
15178
15179 .. _v3.14.0:
15180
15181 -------------------
15182 3.14.0 - 2017-07-23
15183 -------------------
15184
15185 Hypothesis now understands inline type annotations (:issue:`293`):
15186
15187 - If the target of :func:`~hypothesis.strategies.builds` has type annotations,
15188 a default strategy for missing required arguments is selected based on the
15189 type. Type-based strategy selection will only override a default if you
15190 pass :const:`hypothesis.infer` as a keyword argument.
15191
15192 - If :func:`@given <hypothesis.given>` wraps a function with type annotations,
15193 you can pass :const:`~hypothesis.infer` as a keyword argument and the
15194 appropriate strategy will be substituted.
15195
15196 - You can check what strategy will be inferred for a type with the new
15197 :func:`~hypothesis.strategies.from_type` function.
15198
15199 - :func:`~hypothesis.strategies.register_type_strategy` teaches Hypothesis
15200 which strategy to infer for custom or unknown types. You can provide a
15201 strategy, or for more complex cases a function which takes the type and
15202 returns a strategy.
15203
15204 .. _v3.13.1:
15205
15206 -------------------
15207 3.13.1 - 2017-07-20
15208 -------------------
15209
15210 This is a bug fix release for :issue:`514` - Hypothesis would continue running
15211 examples after a :class:`~python:unittest.SkipTest` exception was raised,
15212 including printing a falsifying example. Skip exceptions from the standard
15213 :mod:`python:unittest` module, and ``pytest``, ``nose``, or ``unittest2``
15214 modules now abort the test immediately without printing output.
15215
15216 .. _v3.13.0:
15217
15218 -------------------
15219 3.13.0 - 2017-07-16
15220 -------------------
15221
15222 This release has two major aspects to it: The first is the introduction of
15223 :func:`~hypothesis.strategies.deferred`, which allows more natural definition
15224 of recursive (including mutually recursive) strategies.
15225
15226 The second is a number of engine changes designed to support this sort of
15227 strategy better. These should have a knock-on effect of also improving the
15228 performance of any existing strategies that currently generate a lot of data
15229 or involve heavy nesting by reducing their typical example size.
15230
15231 .. _v3.12.0:
15232
15233 -------------------
15234 3.12.0 - 2017-07-07
15235 -------------------
15236
15237 This release makes some major internal changes to how Hypothesis represents
15238 data internally, as a prelude to some major engine changes that should improve
15239 data quality. There are no API changes, but it's a significant enough internal
15240 change that a minor version bump seemed warranted.
15241
15242 User facing impact should be fairly mild, but includes:
15243
15244 * All existing examples in the database will probably be invalidated. Hypothesis
15245 handles this automatically, so you don't need to do anything, but if you see
15246 all your examples disappear that's why.
15247 * Almost all data distributions have changed significantly. Possibly for the better,
15248 possibly for the worse. This may result in new bugs being found, but it may
15249 also result in Hypothesis being unable to find bugs it previously did.
15250 * Data generation may be somewhat faster if your existing bottleneck was in
15251 draw_bytes (which is often the case for large examples).
15252 * Shrinking will probably be slower, possibly significantly.
15253
15254 If you notice any effects you consider to be a significant regression, please
15255 open an issue about them.
15256
15257 .. _v3.11.6:
15258
15259 -------------------
15260 3.11.6 - 2017-06-19
15261 -------------------
15262
15263 This release involves no functionality changes, but is the first to ship wheels
15264 as well as an sdist.
15265
15266 .. _v3.11.5:
15267
15268 -------------------
15269 3.11.5 - 2017-06-18
15270 -------------------
15271
15272 This release provides a performance improvement to shrinking. For cases where
15273 there is some non-trivial "boundary" value (e.g. the bug happens for all values
15274 greater than some other value), shrinking should now be substantially faster.
15275 Other types of bug will likely see improvements too.
15276
15277 This may also result in some changes to the quality of the final examples - it
15278 may sometimes be better, but is more likely to get slightly worse in some edge
15279 cases. If you see any examples where this happens in practice, please report
15280 them.
15281
15282 .. _v3.11.4:
15283
15284 -------------------
15285 3.11.4 - 2017-06-17
15286 -------------------
15287
15288 This is a bugfix release: Hypothesis now prints explicit examples when
15289 running in verbose mode. (:issue:`313`)
15290
15291 .. _v3.11.3:
15292
15293 -------------------
15294 3.11.3 - 2017-06-11
15295 -------------------
15296
15297 This is a bugfix release: Hypothesis no longer emits a warning if you try to
15298 use :func:`~hypothesis.strategies.sampled_from` with
15299 :class:`python:collections.OrderedDict`. (:issue:`688`)
15300
15301 .. _v3.11.2:
15302
15303 -------------------
15304 3.11.2 - 2017-06-10
15305 -------------------
15306
15307 This is a documentation release. Several outdated snippets have been updated
15308 or removed, and many cross-references are now hyperlinks.
15309
15310 .. _v3.11.1:
15311
15312 -------------------
15313 3.11.1 - 2017-05-28
15314 -------------------
15315
15316 This is a minor ergonomics release. Tracebacks shown by pytest no longer
15317 include Hypothesis internals for test functions decorated with :func:`@given <hypothesis.given>`.
15318
15319 .. _v3.11.0:
15320
15321 -------------------
15322 3.11.0 - 2017-05-23
15323 -------------------
15324
15325 This is a feature release, adding datetime-related strategies to the core strategies.
15326
15327 :func:`~hypothesis.extra.pytz.timezones` allows you to sample pytz timezones from
15328 the Olsen database. Use directly in a recipe for tz-aware datetimes, or
15329 compose with :func:`~hypothesis.strategies.none` to allow a mix of aware and naive output.
15330
15331 The new :func:`~hypothesis.strategies.dates`, :func:`~hypothesis.strategies.times`,
15332 :func:`~hypothesis.strategies.datetimes`, and :func:`~hypothesis.strategies.timedeltas`
15333 strategies are all constrained by objects of their type.
15334 This means that you can generate dates bounded by a single day
15335 (i.e. a single date), or datetimes constrained to the microsecond.
15336
15337 :func:`~hypothesis.strategies.times` and :func:`~hypothesis.strategies.datetimes`
15338 take an optional ``timezones=`` argument, which
15339 defaults to :func:`~hypothesis.strategies.none` for naive times. You can use our extra strategy
15340 based on pytz, or roll your own timezones strategy with dateutil or even
15341 the standard library.
15342
15343 The old ``dates``, ``times``, and ``datetimes`` strategies in
15344 ``hypothesis.extra.datetimes`` are deprecated in favor of the new
15345 core strategies, which are more flexible and have no dependencies.
15346
15347 .. _v3.10.0:
15348
15349 -------------------
15350 3.10.0 - 2017-05-22
15351 -------------------
15352
15353 Hypothesis now uses :func:`python:inspect.getfullargspec` internally.
15354 On Python 2, there are no visible changes.
15355
15356 On Python 3 :func:`@given <hypothesis.given>` and :func:`@composite <hypothesis.strategies.composite>`
15357 now preserve :pep:`3107` annotations on the
15358 decorated function. Keyword-only arguments are now either handled correctly
15359 (e.g. :func:`@composite <hypothesis.strategies.composite>`), or caught in validation instead of silently discarded
15360 or raising an unrelated error later (e.g. :func:`@given <hypothesis.given>`).
15361
15362 .. _v3.9.1:
15363
15364 ------------------
15365 3.9.1 - 2017-05-22
15366 ------------------
15367
15368 This is a bugfix release: the default field mapping for a DateTimeField in the
15369 Django extra now respects the ``USE_TZ`` setting when choosing a strategy.
15370
15371 .. _v3.9.0:
15372
15373 ------------------
15374 3.9.0 - 2017-05-19
15375 ------------------
15376
15377 This is feature release, expanding the capabilities of the
15378 :func:`~hypothesis.strategies.decimals` strategy.
15379
15380 * The new (optional) ``places`` argument allows you to generate decimals with
15381 a certain number of places (e.g. cents, thousandths, satoshis).
15382 * If allow_infinity is None, setting min_bound no longer excludes positive
15383 infinity and setting max_value no longer excludes negative infinity.
15384 * All of ``NaN``, ``-Nan``, ``sNaN``, and ``-sNaN`` may now be drawn if
15385 allow_nan is True, or if allow_nan is None and min_value or max_value is None.
15386 * min_value and max_value may be given as decimal strings, e.g. ``"1.234"``.
15387
15388
15389 .. _v3.8.5:
15390
15391 ------------------
15392 3.8.5 - 2017-05-16
15393 ------------------
15394
15395 Hypothesis now imports :mod:`python:sqlite3` when a SQLite database is used, rather
15396 than at module load, improving compatibility with Python implementations
15397 compiled without SQLite support (such as BSD or Jython).
15398
15399 .. _v3.8.4:
15400
15401 ------------------
15402 3.8.4 - 2017-05-16
15403 ------------------
15404
15405 This is a compatibility bugfix release. :func:`~hypothesis.strategies.sampled_from`
15406 no longer raises a deprecation warning when sampling from an
15407 :class:`python:enum.Enum`, as all enums have a reliable iteration order.
15408
15409 .. _v3.8.3:
15410
15411 ------------------
15412 3.8.3 - 2017-05-09
15413 ------------------
15414
15415 This release removes a version check for older versions of :pypi:`pytest` when using
15416 the Hypothesis pytest plugin. The pytest plugin will now run unconditionally
15417 on all versions of pytest. This breaks compatibility with any version of pytest
15418 prior to 2.7.0 (which is more than two years old).
15419
15420 The primary reason for this change is that the version check was a frequent
15421 source of breakage when pytest change their versioning scheme. If you are not
15422 working on pytest itself and are not running a very old version of it, this
15423 release probably doesn't affect you.
15424
15425 .. _v3.8.2:
15426
15427 ------------------
15428 3.8.2 - 2017-04-26
15429 ------------------
15430
15431 This is a code reorganisation release that moves some internal test helpers
15432 out of the main source tree so as to not have changes to them trigger releases
15433 in future.
15434
15435 .. _v3.8.1:
15436
15437 ------------------
15438 3.8.1 - 2017-04-26
15439 ------------------
15440
15441 This is a documentation release. Almost all code examples are now doctests
15442 checked in CI, eliminating stale examples.
15443
15444 .. _v3.8.0:
15445
15446 ------------------
15447 3.8.0 - 2017-04-23
15448 ------------------
15449
15450 This is a feature release, adding the :func:`~hypothesis.strategies.iterables` strategy, equivalent
15451 to ``lists(...).map(iter)`` but with a much more useful repr. You can use
15452 this strategy to check that code doesn't accidentally depend on sequence
15453 properties such as indexing support or repeated iteration.
15454
15455 .. _v3.7.4:
15456
15457 ------------------
15458 3.7.4 - 2017-04-22
15459 ------------------
15460
15461 This patch fixes a bug in :ref:`3.7.3 <v3.7.3>`, where using
15462 :obj:`@example <hypothesis.example>` and a pytest fixture in the same test
15463 could cause the test to fail to fill the arguments, and throw a TypeError.
15464
15465 .. _v3.7.3:
15466
15467 ------------------
15468 3.7.3 - 2017-04-21
15469 ------------------
15470
15471 This release should include no user visible changes and is purely a refactoring
15472 release. This modularises the behaviour of the core :func:`~hypothesis.given` function, breaking
15473 it up into smaller and more accessible parts, but its actual behaviour should
15474 remain unchanged.
15475
15476 .. _v3.7.2:
15477
15478 ------------------
15479 3.7.2 - 2017-04-21
15480 ------------------
15481
15482 This reverts an undocumented change in :ref:`3.7.1 <v3.7.1>` which broke installation on
15483 debian stable: The specifier for the hypothesis[django] extra\_requires had
15484 introduced a wild card, which was not supported on the default version of pip.
15485
15486 .. _v3.7.1:
15487
15488 ------------------
15489 3.7.1 - 2017-04-21
15490 ------------------
15491
15492 This is a bug fix and internal improvements release.
15493
15494 * In particular Hypothesis now tracks a tree of where it has already explored.
15495 This allows it to avoid some classes of duplicate examples, and significantly
15496 improves the performance of shrinking failing examples by allowing it to
15497 skip some shrinks that it can determine can't possibly work.
15498 * Hypothesis will no longer seed the global random arbitrarily unless you have
15499 asked it to using :py:meth:`~hypothesis.strategies.random_module`
15500 * Shrinking would previously have not worked correctly in some special cases
15501 on Python 2, and would have resulted in suboptimal examples.
15502
15503 .. _v3.7.0:
15504
15505 ------------------
15506 3.7.0 - 2017-03-20
15507 ------------------
15508
15509 This is a feature release.
15510
15511 New features:
15512
15513 * Rule based stateful testing now has an :func:`@invariant <hypothesis.stateful.invariant>` decorator that specifies
15514 methods that are run after init and after every step, allowing you to
15515 encode properties that should be true at all times. Thanks to Tom Prince for
15516 this feature.
15517 * The :func:`~hypothesis.strategies.decimals` strategy now supports ``allow_nan`` and ``allow_infinity`` flags.
15518 * There are :ref:`significantly more strategies available for numpy <hypothesis-numpy>`, including for
15519 generating arbitrary data types. Thanks to Zac Hatfield Dodds for this
15520 feature.
15521 * When using the :func:`~hypothesis.strategies.data` strategy you can now add a label as an argument to
15522 ``draw()``, which will be printed along with the value when an example fails.
15523 Thanks to Peter Inglesby for this feature.
15524
15525 Bug fixes:
15526
15527 * Bug fix: :func:`~hypothesis.strategies.composite` now preserves functions' docstrings.
15528 * The build is now reproducible and doesn't depend on the path you build it
15529 from. Thanks to Chris Lamb for this feature.
15530 * numpy strategies for the void data type did not work correctly. Thanks to
15531 Zac Hatfield Dodds for this fix.
15532
15533 There have also been a number of performance optimizations:
15534
15535 * The :func:`~hypothesis.strategies.permutations` strategy is now significantly faster to use for large
15536 lists (the underlying algorithm has gone from O(n^2) to O(n)).
15537 * Shrinking of failing test cases should have got significantly faster in
15538 some circumstances where it was previously struggling for a long time.
15539 * Example generation now involves less indirection, which results in a small
15540 speedup in some cases (small enough that you won't really notice it except in
15541 pathological cases).
15542
15543
15544 .. _v3.6.1:
15545
15546 ------------------
15547 3.6.1 - 2016-12-20
15548 ------------------
15549
15550 This release fixes a dependency problem and makes some small behind the scenes
15551 improvements.
15552
15553 * The fake-factory dependency was renamed to faker. If you were depending on
15554 it through hypothesis[django] or hypothesis[fake-factory] without pinning it
15555 yourself then it would have failed to install properly. This release changes
15556 it so that hypothesis[fakefactory] (which can now also be installed as
15557 hypothesis[faker]) will install the renamed faker package instead.
15558 * This release also removed the dependency of hypothesis[django] on
15559 hypothesis[fakefactory] - it was only being used for emails. These now use
15560 a custom strategy that isn't from fakefactory. As a result you should also
15561 see performance improvements of tests which generated User objects or other
15562 things with email fields, as well as better shrinking of email addresses.
15563 * The distribution of code using nested calls to :func:`~hypothesis.strategies.one_of` or the ``|`` operator for
15564 combining strategies has been improved, as branches are now flattened to give
15565 a more uniform distribution.
15566 * Examples using :func:`~hypothesis.strategies.composite` or |.flatmap| should now shrink better. In particular
15567 this will affect things which work by first generating a length and then
15568 generating that many items, which have historically not shrunk very well.
15569
15570 .. _v3.6.0:
15571
15572 ------------------
15573 3.6.0 - 2016-10-31
15574 ------------------
15575
15576 This release reverts Hypothesis to its old pretty printing of lambda functions
15577 based on attempting to extract the source code rather than decompile the bytecode.
15578 This is unfortunately slightly inferior in some cases and may result in you
15579 occasionally seeing things like ``lambda x: <unknown>`` in statistics reports and
15580 strategy reprs.
15581
15582 This removes the dependencies on uncompyle6, xdis and spark-parser.
15583
15584 The reason for this is that the new functionality was based on uncompyle6, which
15585 turns out to introduce a hidden GPLed dependency - it in turn depended on xdis,
15586 and although the library was licensed under the MIT license, it contained some
15587 GPL licensed source code and thus should have been released under the GPL.
15588
15589 My interpretation is that Hypothesis itself was never in violation of the GPL
15590 (because the license it is under, the Mozilla Public License v2, is fully
15591 compatible with being included in a GPL licensed work), but I have not consulted
15592 a lawyer on the subject. Regardless of the answer to this question, adding a
15593 GPLed dependency will likely cause a lot of users of Hypothesis to inadvertently
15594 be in violation of the GPL.
15595
15596 As a result, if you are running Hypothesis 3.5.x you really should upgrade to
15597 this release immediately.
15598
15599 .. _v3.5.3:
15600
15601 ------------------
15602 3.5.3 - 2016-10-05
15603 ------------------
15604
15605 This is a bug fix release.
15606
15607 Bugs fixed:
15608
15609 * If the same test was running concurrently in two processes and there were
15610 examples already in the test database which no longer failed, Hypothesis
15611 would sometimes fail with a FileNotFoundError (IOError on Python 2) because
15612 an example it was trying to read was deleted before it was read. (:issue:`372`).
15613 * Drawing from an :func:`~hypothesis.strategies.integers` strategy with both a min_value and a max_value
15614 would reject too many examples needlessly. Now it repeatedly redraws until
15615 satisfied. (:pull:`366`. Thanks to Calen Pennington for the contribution).
15616
15617 .. _v3.5.2:
15618
15619 ------------------
15620 3.5.2 - 2016-09-24
15621 ------------------
15622
15623 This is a bug fix release.
15624
15625 * The Hypothesis pytest plugin broke pytest support for doctests. Now it doesn't.
15626
15627 .. _v3.5.1:
15628
15629 ------------------
15630 3.5.1 - 2016-09-23
15631 ------------------
15632
15633 This is a bug fix release.
15634
15635 * Hypothesis now runs cleanly in -B and -BB modes, avoiding mixing bytes and unicode.
15636 * :class:`python:unittest.TestCase` tests would not have shown up in the new statistics mode. Now they
15637 do.
15638 * Similarly, stateful tests would not have shown up in statistics and now they do.
15639 * Statistics now print with pytest node IDs (the names you'd get in pytest verbose mode).
15640
15641 .. _v3.5.0:
15642
15643 ------------------
15644 3.5.0 - 2016-09-22
15645 ------------------
15646
15647 This is a feature release.
15648
15649 * :func:`~hypothesis.strategies.fractions` and :func:`~hypothesis.strategies.decimals` strategies now support min_value and max_value
15650 parameters. Thanks go to Anne Mulhern for the development of this feature.
15651 * The Hypothesis pytest plugin now supports a ``--hypothesis-show-statistics`` parameter
15652 that gives detailed statistics about the tests that were run. Huge thanks to
15653 Jean-Louis Fuchs and Adfinis-SyGroup for funding the development of this feature.
15654 * There is a new :func:`~hypothesis.event` function that can be used to add custom statistics.
15655
15656 Additionally there have been some minor bug fixes:
15657
15658 * In some cases Hypothesis should produce fewer duplicate examples (this will mostly
15659 only affect cases with a single parameter).
15660 * :pypi:`pytest` command line parameters are now under an option group for Hypothesis (thanks
15661 to David Keijser for fixing this)
15662 * Hypothesis would previously error if you used :pep:`3107` function annotations on your tests under
15663 Python 3.4.
15664 * The repr of many strategies using lambdas has been improved to include the lambda body
15665 (this was previously supported in many but not all cases).
15666
15667 .. _v3.4.2:
15668
15669 ------------------
15670 3.4.2 - 2016-07-13
15671 ------------------
15672
15673 This is a bug fix release, fixing a number of problems with the settings system:
15674
15675 * Test functions defined using :func:`@given <hypothesis.given>` can now be called from other threads
15676 (:issue:`337`)
15677 * Attempting to delete a settings property would previously have silently done
15678 the wrong thing. Now it raises an AttributeError.
15679 * Creating a settings object with a custom database_file parameter was silently
15680 getting ignored and the default was being used instead. Now it's not.
15681
15682 .. _v3.4.1:
15683
15684 ------------------
15685 3.4.1 - 2016-07-07
15686 ------------------
15687
15688 This is a bug fix release for a single bug:
15689
15690 * On Windows when running two Hypothesis processes in parallel (e.g. using
15691 :pypi:`pytest-xdist`) they could race with each other and one would raise an exception
15692 due to the non-atomic nature of file renaming on Windows and the fact that you
15693 can't rename over an existing file. This is now fixed.
15694
15695 .. _v3.4.0:
15696
15697 ------------------
15698 3.4.0 - 2016-05-27
15699 ------------------
15700
15701 This release is entirely provided by `Lucas Wiman <https://github.com/lucaswiman>`_:
15702
15703 Strategies constructed by the Django extra
15704 will now respect much more of Django's validations out of the box.
15705 Wherever possible, :meth:`~django:django.db.models.Model.full_clean` should
15706 succeed.
15707
15708 In particular:
15709
15710 * The max_length, blank and choices kwargs are now respected.
15711 * Add support for DecimalField.
15712 * If a field includes validators, the list of validators are used to filter the field strategy.
15713
15714 .. _v3.3.0:
15715
15716 ------------------
15717 3.3.0 - 2016-05-27
15718 ------------------
15719
15720 This release went wrong and is functionally equivalent to :ref:`3.2.0 <v3.2.0>`. Ignore it.
15721
15722 .. _v3.2.0:
15723
15724 ------------------
15725 3.2.0 - 2016-05-19
15726 ------------------
15727
15728 This is a small single-feature release:
15729
15730 * All tests using :func:`@given <hypothesis.given>` now fix the global random seed. This removes the health
15731 check for that. If a non-zero seed is required for the final falsifying
15732 example, it will be reported. Otherwise Hypothesis will assume randomization
15733 was not a significant factor for the test and be silent on the subject. If you
15734 use :func:`~hypothesis.strategies.random_module` this will continue to work and will always
15735 display the seed.
15736
15737 .. _v3.1.3:
15738
15739 ------------------
15740 3.1.3 - 2016-05-01
15741 ------------------
15742
15743 Single bug fix release
15744
15745 * Another charmap problem. In :ref:`3.1.2 <v3.1.2>` :func:`~hypothesis.strategies.text` and
15746 :func:`~hypothesis.strategies.characters` would break on systems
15747 which had ``/tmp`` mounted on a different partition than the Hypothesis storage
15748 directory (usually in home). This fixes that.
15749
15750 .. _v3.1.2:
15751
15752 ------------------
15753 3.1.2 - 2016-04-30
15754 ------------------
15755
15756 Single bug fix release:
15757
15758 * Anything which used a :func:`~hypothesis.strategies.text` or
15759 :func:`~hypothesis.strategies.characters` strategy was broken on Windows
15760 and I hadn't updated appveyor to use the new repository location so I didn't
15761 notice. This is now fixed and windows support should work correctly.
15762
15763 .. _v3.1.1:
15764
15765 ------------------
15766 3.1.1 - 2016-04-29
15767 ------------------
15768
15769 Minor bug fix release.
15770
15771 * Fix concurrency issue when running tests that use :func:`~hypothesis.strategies.text` from multiple
15772 processes at once (:issue:`302`, thanks to Alex Chan).
15773 * Improve performance of code using :func:`~hypothesis.strategies.lists` with max_size (thanks to
15774 Cristi Cobzarenco).
15775 * Fix install on Python 2 with ancient versions of pip so that it installs the
15776 :pypi:`enum34` backport (thanks to Donald Stufft for telling me how to do this).
15777 * Remove duplicated __all__ exports from hypothesis.strategies (thanks to
15778 Piët Delport).
15779 * Update headers to point to new repository location.
15780 * Allow use of strategies that can't be used in ``find()``
15781 (e.g. ``choices()``) in stateful testing.
15782
15783
15784 .. _v3.1.0:
15785
15786 ------------------
15787 3.1.0 - 2016-03-06
15788 ------------------
15789
15790 * Add a :func:`~hypothesis.strategies.nothing` strategy that never successfully generates values.
15791 * :func:`~hypothesis.strategies.sampled_from` and :func:`~hypothesis.strategies.one_of`
15792 can both now be called with an empty argument
15793 list, in which case they also never generate any values.
15794 * :func:`~hypothesis.strategies.one_of` may now be called with a single argument that is a collection of strategies
15795 as well as varargs.
15796 * Add a :func:`~hypothesis.strategies.runner` strategy which returns the instance of the current test object
15797 if there is one.
15798 * 'Bundle' for RuleBasedStateMachine is now a normal(ish) strategy and can be used
15799 as such.
15800 * Tests using RuleBasedStateMachine should now shrink significantly better.
15801 * Hypothesis now uses a pretty-printing library internally, compatible with IPython's
15802 pretty printing protocol (actually using the same code). This may improve the quality
15803 of output in some cases.
15804 * Add a 'phases' setting that allows more fine grained control over which parts of the
15805 process Hypothesis runs
15806 * Add a suppress_health_check setting which allows you to turn off specific health checks
15807 in a fine grained manner.
15808 * Fix a bug where lists of non fixed size would always draw one more element than they
15809 included. This mostly didn't matter, but if would cause problems with empty strategies
15810 or ones with side effects.
15811 * Add a mechanism to the Django model generator to allow you to explicitly request the
15812 default value (thanks to Jeremy Thurgood for this one).
15813
15814 .. _v3.0.5:
15815
15816 ------------------
15817 3.0.5 - 2016-02-25
15818 ------------------
15819
15820 * Fix a bug where Hypothesis would now error on :pypi:`pytest` development versions.
15821
15822 .. _v3.0.4:
15823
15824 ------------------
15825 3.0.4 - 2016-02-24
15826 ------------------
15827
15828 * Fix a bug where Hypothesis would error when running on Python 2.7.3 or
15829 earlier because it was trying to pass a :class:`python:bytearray` object
15830 to :func:`python:struct.unpack` (which is only supported since 2.7.4).
15831
15832 .. _v3.0.3:
15833
15834 ------------------
15835 3.0.3 - 2016-02-23
15836 ------------------
15837
15838 * Fix version parsing of pytest to work with pytest release candidates
15839 * More general handling of the health check problem where things could fail because
15840 of a cache miss - now one "free" example is generated before the start of the
15841 health check run.
15842
15843 .. _v3.0.2:
15844
15845 ------------------
15846 3.0.2 - 2016-02-18
15847 ------------------
15848
15849 * Under certain circumstances, strategies involving :func:`~hypothesis.strategies.text` buried inside some
15850 other strategy (e.g. ``text().filter(...)`` or ``recursive(text(), ...))`` would cause
15851 a test to fail its health checks the first time it ran. This was caused by having
15852 to compute some related data and cache it to disk. On travis or anywhere else
15853 where the ``.hypothesis`` directory was recreated this would have caused the tests
15854 to fail their health check on every run. This is now fixed for all the known cases,
15855 although there could be others lurking.
15856
15857 .. _v3.0.1:
15858
15859 ------------------
15860 3.0.1 - 2016-02-18
15861 ------------------
15862
15863 * Fix a case where it was possible to trigger an "Unreachable" assertion when
15864 running certain flaky stateful tests.
15865 * Improve shrinking of large stateful tests by eliminating a case where it was
15866 hard to delete early steps.
15867 * Improve efficiency of drawing :func:`binary(min_size=n, max_size=n) <hypothesis.strategies.binary>` significantly by
15868 provide a custom implementation for fixed size blocks that can bypass a lot
15869 of machinery.
15870 * Set default home directory based on the current working directory at the
15871 point Hypothesis is imported, not whenever the function first happens to be
15872 called.
15873
15874 .. _v3.0.0:
15875
15876 ------------------
15877 3.0.0 - 2016-02-17
15878 ------------------
15879
15880 Codename: This really should have been 2.1.
15881
15882 Externally this looks like a very small release. It has one small breaking change
15883 that probably doesn't affect anyone at all (some behaviour that never really worked
15884 correctly is now outright forbidden) but necessitated a major version bump and one
15885 visible new feature.
15886
15887 Internally this is a complete rewrite. Almost nothing other than the public API is
15888 the same.
15889
15890 New features:
15891
15892 * Addition of :func:`~hypothesis.strategies.data` strategy which allows you to draw arbitrary data interactively
15893 within the test.
15894 * New "exploded" database format which allows you to more easily check the example
15895 database into a source repository while supporting merging.
15896 * Better management of how examples are saved in the database.
15897 * Health checks will now raise as errors when they fail. It was too easy to have
15898 the warnings be swallowed entirely.
15899
15900 New limitations:
15901
15902 * ``choices()`` and ``streaming()``
15903 strategies may no longer be used with ``find()``. Neither may
15904 :func:`~hypothesis.strategies.data` (this is the change that necessitated a major version bump).
15905
15906 Feature removal:
15907
15908 * The ForkingTestCase executor has gone away. It may return in some more working
15909 form at a later date.
15910
15911 Performance improvements:
15912
15913 * A new model which allows flatmap, composite strategies and stateful testing to
15914 perform *much* better. They should also be more reliable.
15915 * Filtering may in some circumstances have improved significantly. This will
15916 help especially in cases where you have lots of values with individual filters
15917 on them, such as lists(x.filter(...)).
15918 * Modest performance improvements to the general test runner by avoiding expensive
15919 operations
15920
15921 In general your tests should have got faster. If they've instead got significantly
15922 slower, I'm interested in hearing about it.
15923
15924 Data distribution:
15925
15926 The data distribution should have changed significantly. This may uncover bugs the
15927 previous version missed. It may also miss bugs the previous version could have
15928 uncovered. Hypothesis is now producing less strongly correlated data than it used
15929 to, but the correlations are extended over more of the structure.
15930
15931 Shrinking:
15932
15933 Shrinking quality should have improved. In particular Hypothesis can now perform
15934 simultaneous shrinking of separate examples within a single test (previously it
15935 was only able to do this for elements of a single collection). In some cases
15936 performance will have improved, in some cases it will have got worse but generally
15937 shouldn't have by much.
15938
15939
15940 Older versions
15941 ==============
15942
15943 .. _v2.0.0:
15944
15945 ------------------
15946 2.0.0 - 2016-01-10
15947 ------------------
15948
15949 Codename: A new beginning
15950
15951 This release cleans up all of the legacy that accrued in the course of
15952 Hypothesis 1.0. These are mostly things that were emitting deprecation warnings
15953 in 1.19.0, but there were a few additional changes.
15954
15955 In particular:
15956
15957 * non-strategy values will no longer be converted to strategies when used in
15958 given or find.
15959 * FailedHealthCheck is now an error and not a warning.
15960 * Handling of non-ascii reprs in user types have been simplified by using raw
15961 strings in more places in Python 2.
15962 * given no longer allows mixing positional and keyword arguments.
15963 * given no longer works with functions with defaults.
15964 * given no longer turns provided arguments into defaults - they will not appear
15965 in the argspec at all.
15966 * the basic() strategy no longer exists.
15967 * the n_ary_tree strategy no longer exists.
15968 * the average_list_length setting no longer exists. Note: If you're using
15969 using recursive() this will cause you a significant slow down. You should
15970 pass explicit average_size parameters to collections in recursive calls.
15971 * @rule can no longer be applied to the same method twice.
15972 * Python 2.6 and 3.3 are no longer officially supported, although in practice
15973 they still work fine.
15974
15975 This also includes two non-deprecation changes:
15976
15977 * given's keyword arguments no longer have to be the rightmost arguments and
15978 can appear anywhere in the method signature.
15979 * The max_shrinks setting would sometimes not have been respected.
15980
15981
15982 .. _v1.19.0:
15983
15984 -------------------
15985 1.19.0 - 2016-01-09
15986 -------------------
15987
15988 Codename: IT COMES
15989
15990 This release heralds the beginning of a new and terrible age of Hypothesis 2.0.
15991
15992 It's primary purpose is some final deprecations prior to said release. The goal
15993 is that if your code emits no warnings under this release then it will probably run
15994 unchanged under Hypothesis 2.0 (there are some caveats to this: 2.0 will drop
15995 support for some Python versions, and if you're using internal APIs then as usual
15996 that may break without warning).
15997
15998 It does have two new features:
15999
16000 * New @seed() decorator which allows you to manually seed a test. This may be
16001 harmlessly combined with and overrides the derandomize setting.
16002 * settings objects may now be used as a decorator to fix those settings to a
16003 particular @given test.
16004
16005 API changes (old usage still works but is deprecated):
16006
16007 * Settings has been renamed to settings (lower casing) in order to make the
16008 decorator usage more natural.
16009 * Functions for the storage directory that were in hypothesis.settings are now
16010 in a new hypothesis.configuration module.
16011
16012 Additional deprecations:
16013
16014 * the average_list_length setting has been deprecated in favour of being
16015 explicit.
16016 * the basic() strategy has been deprecated as it is impossible to support
16017 it under a Conjecture based model, which will hopefully be implemented at
16018 some point in the 2.x series.
16019 * the n_ary_tree strategy (which was never actually part of the public API)
16020 has been deprecated.
16021 * Passing settings or random as keyword arguments to given is deprecated (use
16022 the new functionality instead)
16023
16024
16025 Bug fixes:
16026
16027 * No longer emit PendingDeprecationWarning for __iter__ and StopIteration in
16028 streaming() values.
16029 * When running in health check mode with non strict, don't print quite so
16030 many errors for an exception in reify.
16031 * When an assumption made in a test or a filter is flaky, tests will now
16032 raise Flaky instead of UnsatisfiedAssumption.
16033
16034
16035 .. _v1.18.1:
16036
16037 -------------------
16038 1.18.1 - 2015-12-22
16039 -------------------
16040
16041 Two behind the scenes changes:
16042
16043 * Hypothesis will no longer write generated code to the file system. This
16044 will improve performance on some systems (e.g. if you're using
16045 `PythonAnywhere <https://www.pythonanywhere.com/>`_ which is running your
16046 code from NFS) and prevent some annoying interactions with auto-restarting
16047 systems.
16048 * Hypothesis will cache the creation of some strategies. This can significantly
16049 improve performance for code that uses flatmap or composite and thus has to
16050 instantiate strategies a lot.
16051
16052 .. _v1.18.0:
16053
16054 -------------------
16055 1.18.0 - 2015-12-21
16056 -------------------
16057
16058 Features:
16059
16060 * Tests and find are now explicitly seeded off the global random module. This
16061 means that if you nest one inside the other you will now get a health check
16062 error. It also means that you can control global randomization by seeding
16063 random.
16064 * There is a new random_module() strategy which seeds the global random module
16065 for you and handles things so that you don't get a health check warning if
16066 you use it inside your tests.
16067 * floats() now accepts two new arguments: allow\_nan and allow\_infinity. These
16068 default to the old behaviour, but when set to False will do what the names
16069 suggest.
16070
16071 Bug fixes:
16072
16073 * Fix a bug where tests that used text() on Python 3.4+ would not actually be
16074 deterministic even when explicitly seeded or using the derandomize mode,
16075 because generation depended on dictionary iteration order which was affected
16076 by hash randomization.
16077 * Fix a bug where with complicated strategies the timing of the initial health
16078 check could affect the seeding of the subsequent test, which would also
16079 render supposedly deterministic tests non-deterministic in some scenarios.
16080 * In some circumstances flatmap() could get confused by two structurally
16081 similar things it could generate and would produce a flaky test where the
16082 first time it produced an error but the second time it produced the other
16083 value, which was not an error. The same bug was presumably also possible in
16084 composite().
16085 * flatmap() and composite() initial generation should now be moderately faster.
16086 This will be particularly noticeable when you have many values drawn from the
16087 same strategy in a single run, e.g. constructs like lists(s.flatmap(f)).
16088 Shrinking performance *may* have suffered, but this didn't actually produce
16089 an interestingly worse result in any of the standard scenarios tested.
16090
16091 .. _v1.17.1:
16092
16093 -------------------
16094 1.17.1 - 2015-12-16
16095 -------------------
16096
16097 A small bug fix release, which fixes the fact that the 'note' function could
16098 not be used on tests which used the @example decorator to provide explicit
16099 examples.
16100
16101 .. _v1.17.0:
16102
16103 -------------------
16104 1.17.0 - 2015-12-15
16105 -------------------
16106
16107 This is actually the same release as 1.16.1, but 1.16.1 has been pulled because
16108 it contains the following additional change that was not intended to be in a
16109 patch release (it's perfectly stable, but is a larger change that should have
16110 required a minor version bump):
16111
16112 * Hypothesis will now perform a series of "health checks" as part of running
16113 your tests. These detect and warn about some common error conditions that
16114 people often run into which wouldn't necessarily have caused the test to fail
16115 but would cause e.g. degraded performance or confusing results.
16116
16117 .. _v1.16.1:
16118
16119 -------------------
16120 1.16.1 - 2015-12-14
16121 -------------------
16122
16123 Note: This release has been removed.
16124
16125 A small bugfix release that allows bdists for Hypothesis to be built
16126 under 2.7 - the compat3.py file which had Python 3 syntax wasn't intended
16127 to be loaded under Python 2, but when building a bdist it was. In particular
16128 this would break running setup.py test.
16129
16130 .. _v1.16.0:
16131
16132 -------------------
16133 1.16.0 - 2015-12-08
16134 -------------------
16135
16136 There are no public API changes in this release but it includes a behaviour
16137 change that I wasn't comfortable putting in a patch release.
16138
16139 * Functions from hypothesis.strategies will no longer raise InvalidArgument
16140 on bad arguments. Instead the same errors will be raised when a test
16141 using such a strategy is run. This may improve startup time in some
16142 cases, but the main reason for it is so that errors in strategies
16143 won't cause errors in loading, and it can interact correctly with things
16144 like pytest.mark.skipif.
16145 * Errors caused by accidentally invoking the legacy API are now much less
16146 confusing, although still throw NotImplementedError.
16147 * hypothesis.extra.django is 1.9 compatible.
16148 * When tests are run with max_shrinks=0 this will now still rerun the test
16149 on failure and will no longer print "Trying example:" before each run.
16150 Additionally note() will now work correctly when used with max_shrinks=0.
16151
16152 .. _v1.15.0:
16153
16154 -------------------
16155 1.15.0 - 2015-11-24
16156 -------------------
16157
16158 A release with two new features.
16159
16160 * A 'characters' strategy for more flexible generation of text with particular
16161 character ranges and types, kindly contributed by `Alexander Shorin <https://github.com/kxepal>`_.
16162 * Add support for preconditions to the rule based stateful testing. Kindly
16163 contributed by `Christopher Armstrong <https://github.com/radix>`_
16164
16165
16166 .. _v1.14.0:
16167
16168 -------------------
16169 1.14.0 - 2015-11-01
16170 -------------------
16171
16172
16173 New features:
16174
16175 * Add 'note' function which lets you include additional information in the
16176 final test run's output.
16177 * Add 'choices' strategy which gives you a choice function that emulates
16178 random.choice.
16179 * Add 'uuid' strategy that generates UUIDs'
16180 * Add 'shared' strategy that lets you create a strategy that just generates a
16181 single shared value for each test run
16182
16183 Bugs:
16184
16185 * Using strategies of the form streaming(x.flatmap(f)) with find or in stateful
16186 testing would have caused InvalidArgument errors when the resulting values
16187 were used (because code that expected to only be called within a test context
16188 would be invoked).
16189
16190
16191 .. _v1.13.0:
16192
16193 -------------------
16194 1.13.0 - 2015-10-29
16195 -------------------
16196
16197 This is quite a small release, but deprecates some public API functions
16198 and removes some internal API functionality so gets a minor version bump.
16199
16200 * All calls to the 'strategy' function are now deprecated, even ones which
16201 pass just a SearchStrategy instance (which is still a no-op).
16202 * Never documented hypothesis.extra entry_points mechanism has now been removed (
16203 it was previously how hypothesis.extra packages were loaded and has been deprecated
16204 and unused for some time)
16205 * Some corner cases that could previously have produced an OverflowError when simplifying
16206 failing cases using hypothesis.extra.datetimes (or dates or times) have now been fixed.
16207 * Hypothesis load time for first import has been significantly reduced - it used to be
16208 around 250ms (on my SSD laptop) and now is around 100-150ms. This almost never
16209 matters but was slightly annoying when using it in the console.
16210 * hypothesis.strategies.randoms was previously missing from \_\_all\_\_.
16211
16212 .. _v1.12.0:
16213
16214 -------------------
16215 1.12.0 - 2015-10-18
16216 -------------------
16217
16218 * Significantly improved performance of creating strategies using the functions
16219 from the hypothesis.strategies module by deferring the calculation of their
16220 repr until it was needed. This is unlikely to have been an performance issue
16221 for you unless you were using flatmap, composite or stateful testing, but for
16222 some cases it could be quite a significant impact.
16223 * A number of cases where the repr of strategies build from lambdas is improved
16224 * Add dates() and times() strategies to hypothesis.extra.datetimes
16225 * Add new 'profiles' mechanism to the settings system
16226 * Deprecates mutability of Settings, both the Settings.default top level property
16227 and individual settings.
16228 * A Settings object may now be directly initialized from a parent Settings.
16229 * @given should now give a better error message if you attempt to use it with a
16230 function that uses destructuring arguments (it still won't work, but it will
16231 error more clearly),
16232 * A number of spelling corrections in error messages
16233 * :pypi:`pytest` should no longer display the intermediate modules Hypothesis generates
16234 when running in verbose mode
16235 * Hypothesis should now correctly handle printing objects with non-ascii reprs
16236 on python 3 when running in a locale that cannot handle ascii printing to
16237 stdout.
16238 * Add a unique=True argument to lists(). This is equivalent to
16239 unique_by=lambda x: x, but offers a more convenient syntax.
16240
16241
16242 .. _v1.11.4:
16243
16244 -------------------
16245 1.11.4 - 2015-09-27
16246 -------------------
16247
16248 * Hide modifications Hypothesis needs to make to sys.path by undoing them
16249 after we've imported the relevant modules. This is a workaround for issues
16250 cryptography experienced on windows.
16251 * Slightly improved performance of drawing from sampled_from on large lists
16252 of alternatives.
16253 * Significantly improved performance of drawing from one_of or strategies
16254 using \| (note this includes a lot of strategies internally - floats()
16255 and integers() both fall into this category). There turned out to be a
16256 massive performance regression introduced in 1.10.0 affecting these which
16257 probably would have made tests using Hypothesis significantly slower than
16258 they should have been.
16259
16260 .. _v1.11.3:
16261
16262 -------------------
16263 1.11.3 - 2015-09-23
16264 -------------------
16265
16266 * Better argument validation for datetimes() strategy - previously setting
16267 max_year < datetime.MIN_YEAR or min_year > datetime.MAX_YEAR would not have
16268 raised an InvalidArgument error and instead would have behaved confusingly.
16269 * Compatibility with being run on pytest < 2.7 (achieved by disabling the
16270 plugin).
16271
16272 .. _v1.11.2:
16273
16274 -------------------
16275 1.11.2 - 2015-09-23
16276 -------------------
16277
16278 Bug fixes:
16279
16280 * Settings(database=my_db) would not be correctly inherited when used as a
16281 default setting, so that newly created settings would use the database_file
16282 setting and create an SQLite example database.
16283 * Settings.default.database = my_db would previously have raised an error and
16284 now works.
16285 * Timeout could sometimes be significantly exceeded if during simplification
16286 there were a lot of examples tried that didn't trigger the bug.
16287 * When loading a heavily simplified example using a basic() strategy from the
16288 database this could cause Python to trigger a recursion error.
16289 * Remove use of deprecated API in pytest plugin so as to not emit warning
16290
16291 Misc:
16292
16293 * hypothesis-pytest is now part of hypothesis core. This should have no
16294 externally visible consequences, but you should update your dependencies to
16295 remove hypothesis-pytest and depend on only Hypothesis.
16296 * Better repr for hypothesis.extra.datetimes() strategies.
16297 * Add .close() method to abstract base class for Backend (it was already present
16298 in the main implementation).
16299
16300 .. _v1.11.1:
16301
16302 -------------------
16303 1.11.1 - 2015-09-16
16304 -------------------
16305
16306 Bug fixes:
16307
16308 * When running Hypothesis tests in parallel (e.g. using pytest-xdist) there was a race
16309 condition caused by code generation.
16310 * Example databases are now cached per thread so as to not use sqlite connections from
16311 multiple threads. This should make Hypothesis now entirely thread safe.
16312 * floats() with only min_value or max_value set would have had a very bad distribution.
16313 * Running on 3.5, Hypothesis would have emitted deprecation warnings because of use of
16314 inspect.getargspec
16315
16316 .. _v1.11.0:
16317
16318 -------------------
16319 1.11.0 - 2015-08-31
16320 -------------------
16321
16322 * text() with a non-string alphabet would have used the repr() of the alphabet
16323 instead of its contexts. This is obviously silly. It now works with any sequence
16324 of things convertible to unicode strings.
16325 * @given will now work on methods whose definitions contains no explicit positional
16326 arguments, only varargs (:issue:`118`).
16327 This may have some knock on effects because it means that @given no longer changes the
16328 argspec of functions other than by adding defaults.
16329 * Introduction of new @composite feature for more natural definition of strategies you'd
16330 previously have used flatmap for.
16331
16332 .. _v1.10.6:
16333
16334 -------------------
16335 1.10.6 - 2015-08-26
16336 -------------------
16337
16338 Fix support for fixtures on Django 1.7.
16339
16340 .. _v1.10.4:
16341
16342 -------------------
16343 1.10.4 - 2015-08-21
16344 -------------------
16345
16346 Tiny bug fix release:
16347
16348 * If the database_file setting is set to None, this would have resulted in
16349 an error when running tests. Now it does the same as setting database to
16350 None.
16351
16352 .. _v1.10.3:
16353
16354 -------------------
16355 1.10.3 - 2015-08-19
16356 -------------------
16357
16358 Another small bug fix release.
16359
16360 * lists(elements, unique_by=some_function, min_size=n) would have raised a
16361 ValidationError if n > Settings.default.average_list_length because it would
16362 have wanted to use an average list length shorter than the minimum size of
16363 the list, which is impossible. Now it instead defaults to twice the minimum
16364 size in these circumstances.
16365 * basic() strategy would have only ever produced at most ten distinct values
16366 per run of the test (which is bad if you e.g. have it inside a list). This
16367 was obviously silly. It will now produce a much better distribution of data,
16368 both duplicated and non duplicated.
16369
16370
16371 .. _v1.10.2:
16372
16373 -------------------
16374 1.10.2 - 2015-08-19
16375 -------------------
16376
16377 This is a small bug fix release:
16378
16379 * star imports from hypothesis should now work correctly.
16380 * example quality for examples using flatmap will be better, as the way it had
16381 previously been implemented was causing problems where Hypothesis was
16382 erroneously labelling some examples as being duplicates.
16383
16384 .. _v1.10.0:
16385
16386 -------------------
16387 1.10.0 - 2015-08-04
16388 -------------------
16389
16390 This is just a bugfix and performance release, but it changes some
16391 semi-public APIs, hence the minor version bump.
16392
16393 * Significant performance improvements for strategies which are one\_of()
16394 many branches. In particular this included recursive() strategies. This
16395 should take the case where you use one recursive() strategy as the base
16396 strategy of another from unusably slow (tens of seconds per generated
16397 example) to reasonably fast.
16398 * Better handling of just() and sampled_from() for values which have an
16399 incorrect \_\_repr\_\_ implementation that returns non-ASCII unicode
16400 on Python 2.
16401 * Better performance for flatmap from changing the internal morpher API
16402 to be significantly less general purpose.
16403 * Introduce a new semi-public BuildContext/cleanup API. This allows
16404 strategies to register cleanup activities that should run once the
16405 example is complete. Note that this will interact somewhat weirdly with
16406 find.
16407 * Better simplification behaviour for streaming strategies.
16408 * Don't error on lambdas which use destructuring arguments in Python 2.
16409 * Add some better reprs for a few strategies that were missing good ones.
16410 * The Random instances provided by randoms() are now copyable.
16411 * Slightly more debugging information about simplify when using a debug
16412 verbosity level.
16413 * Support using given for functions with varargs, but not passing arguments
16414 to it as positional.
16415
16416 .. _v1.9.0:
16417
16418 ------------------
16419 1.9.0 - 2015-07-27
16420 ------------------
16421
16422 Codename: The great bundling.
16423
16424 This release contains two fairly major changes.
16425
16426 The first is the deprecation of the hypothesis-extra mechanism. From
16427 now on all the packages that were previously bundled under it other
16428 than hypothesis-pytest (which is a different beast and will remain
16429 separate). The functionality remains unchanged and you can still import
16430 them from exactly the same location, they just are no longer separate
16431 packages.
16432
16433 The second is that this introduces a new way of building strategies
16434 which lets you build up strategies recursively from other strategies.
16435
16436 It also contains the minor change that calling .example() on a
16437 strategy object will give you examples that are more representative of
16438 the actual data you'll get. There used to be some logic in there to make
16439 the examples artificially simple but this proved to be a bad idea.
16440
16441 .. _v1.8.5:
16442
16443 ------------------
16444 1.8.5 - 2015-07-24
16445 ------------------
16446
16447 This contains no functionality changes but fixes a mistake made with
16448 building the previous package that would have broken installation on
16449 Windows.
16450
16451 .. _v1.8.4:
16452
16453 ------------------
16454 1.8.4 - 2015-07-20
16455 ------------------
16456
16457 Bugs fixed:
16458
16459 * When a call to floats() had endpoints which were not floats but merely
16460 convertible to one (e.g. integers), these would be included in the generated
16461 data which would cause it to generate non-floats.
16462 * Splitting lambdas used in the definition of flatmap, map or filter over
16463 multiple lines would break the repr, which would in turn break their usage.
16464
16465
16466 .. _v1.8.3:
16467
16468 ------------------
16469 1.8.3 - 2015-07-20
16470 ------------------
16471
16472 "Falsifying example" would not have been printed when the failure came from an
16473 explicit example.
16474
16475 .. _v1.8.2:
16476
16477 ------------------
16478 1.8.2 - 2015-07-18
16479 ------------------
16480
16481 Another small bugfix release:
16482
16483 * When using ForkingTestCase you would usually not get the falsifying example
16484 printed if the process exited abnormally (e.g. due to os._exit).
16485 * Improvements to the distribution of characters when using text() with a
16486 default alphabet. In particular produces a better distribution of ascii and
16487 whitespace in the alphabet.
16488
16489 .. _v1.8.1:
16490
16491 ------------------
16492 1.8.1 - 2015-07-17
16493 ------------------
16494
16495 This is a small release that contains a workaround for people who have
16496 bad reprs returning non ascii text on Python 2.7. This is not a bug fix
16497 for Hypothesis per se because that's not a thing that is actually supposed
16498 to work, but Hypothesis leans more heavily on repr than is typical so it's
16499 worth having a workaround for.
16500
16501 .. _v1.8.0:
16502
16503 ------------------
16504 1.8.0 - 2015-07-16
16505 ------------------
16506
16507 New features:
16508
16509 * Much more sensible reprs for strategies, especially ones that come from
16510 hypothesis.strategies. These should now have as reprs python code that
16511 would produce the same strategy.
16512 * lists() accepts a unique_by argument which forces the generated lists to be
16513 only contain elements unique according to some function key (which must
16514 return a hashable value).
16515 * Better error messages from flaky tests to help you debug things.
16516
16517 Mostly invisible implementation details that may result in finding new bugs
16518 in your code:
16519
16520 * Sets and dictionary generation should now produce a better range of results.
16521 * floats with bounds now focus more on 'critical values', trying to produce
16522 values at edge cases.
16523 * flatmap should now have better simplification for complicated cases, as well
16524 as generally being (I hope) more reliable.
16525
16526 Bug fixes:
16527
16528 * You could not previously use assume() if you were using the forking executor.
16529
16530
16531 .. _v1.7.2:
16532
16533 ------------------
16534 1.7.2 - 2015-07-10
16535 ------------------
16536
16537 This is purely a bug fix release:
16538
16539 * When using floats() with stale data in the database you could sometimes get
16540 values in your tests that did not respect min_value or max_value.
16541 * When getting a Flaky error from an unreliable test it would have incorrectly
16542 displayed the example that caused it.
16543 * 2.6 dependency on backports was incorrectly specified. This would only have
16544 caused you problems if you were building a universal wheel from Hypothesis,
16545 which is not how Hypothesis ships, so unless you're explicitly building wheels
16546 for your dependencies and support Python 2.6 plus a later version of Python
16547 this probably would never have affected you.
16548 * If you use flatmap in a way that the strategy on the right hand side depends
16549 sensitively on the left hand side you may have occasionally seen Flaky errors
16550 caused by producing unreliable examples when minimizing a bug. This use case
16551 may still be somewhat fraught to be honest. This code is due a major rearchitecture
16552 for 1.8, but in the meantime this release fixes the only source of this error that
16553 I'm aware of.
16554
16555 .. _v1.7.1:
16556
16557 ------------------
16558 1.7.1 - 2015-06-29
16559 ------------------
16560
16561 Codename: There is no 1.7.0.
16562
16563 A slight technical hitch with a premature upload means there's was a yanked
16564 1.7.0 release. Oops.
16565
16566 The major feature of this release is Python 2.6 support. Thanks to Jeff Meadows
16567 for doing most of the work there.
16568
16569 Other minor features
16570
16571 * strategies now has a permutations() function which returns a strategy
16572 yielding permutations of values from a given collection.
16573 * if you have a flaky test it will print the exception that it last saw before
16574 failing with Flaky, even if you do not have verbose reporting on.
16575 * Slightly experimental git merge script available as "python -m
16576 hypothesis.tools.mergedbs". Instructions on how to use it in the docstring
16577 of that file.
16578
16579 Bug fixes:
16580
16581 * Better performance from use of filter. In particular tests which involve large
16582 numbers of heavily filtered strategies should perform a lot better.
16583 * floats() with a negative min_value would not have worked correctly (worryingly,
16584 it would have just silently failed to run any examples). This is now fixed.
16585 * tests using sampled\_from would error if the number of sampled elements was smaller
16586 than min\_satisfying\_examples.
16587
16588
16589 .. _v1.6.2:
16590
16591 ------------------
16592 1.6.2 - 2015-06-08
16593 ------------------
16594
16595 This is just a few small bug fixes:
16596
16597 * Size bounds were not validated for values for a binary() strategy when
16598 reading examples from the database.
16599 * sampled\_from is now in __all__ in hypothesis.strategies
16600 * floats no longer consider negative integers to be simpler than positive
16601 non-integers
16602 * Small floating point intervals now correctly count members, so if you have a
16603 floating point interval so narrow there are only a handful of values in it,
16604 this will no longer cause an error when Hypothesis runs out of values.
16605
16606 .. _v1.6.1:
16607
16608 ------------------
16609 1.6.1 - 2015-05-21
16610 ------------------
16611
16612 This is a small patch release that fixes a bug where 1.6.0 broke the use
16613 of flatmap with the deprecated API and assumed the passed in function returned
16614 a SearchStrategy instance rather than converting it to a strategy.
16615
16616 .. _v1.6.0:
16617
16618 ------------------
16619 1.6.0 - 2015-05-21
16620 ------------------
16621
16622
16623 This is a smallish release designed to fix a number of bugs and smooth out
16624 some weird behaviours.
16625
16626 * Fix a critical bug in flatmap where it would reuse old strategies. If all
16627 your flatmap code was pure you're fine. If it's not, I'm surprised it's
16628 working at all. In particular if you want to use flatmap with django models,
16629 you desperately need to upgrade to this version.
16630 * flatmap simplification performance should now be better in some cases where
16631 it previously had to redo work.
16632 * Fix for a bug where invalid unicode data with surrogates could be generated
16633 during simplification (it was already filtered out during actual generation).
16634 * The Hypothesis database is now keyed off the name of the test instead of the
16635 type of data. This makes much more sense now with the new strategies API and
16636 is generally more robust. This means you will lose old examples on upgrade.
16637 * The database will now not delete values which fail to deserialize correctly,
16638 just skip them. This is to handle cases where multiple incompatible strategies
16639 share the same key.
16640 * find now also saves and loads values from the database, keyed off a hash of the
16641 function you're finding from.
16642 * Stateful tests now serialize and load values from the database. They should have
16643 before, really. This was a bug.
16644 * Passing a different verbosity level into a test would not have worked entirely
16645 correctly, leaving off some messages. This is now fixed.
16646 * Fix a bug where derandomized tests with unicode characters in the function
16647 body would error on Python 2.7.
16648
16649
16650 .. _v1.5.0:
16651
16652 ------------------
16653 1.5.0 - 2015-05-14
16654 ------------------
16655
16656
16657 Codename: Strategic withdrawal.
16658
16659 The purpose of this release is a radical simplification of the API for building
16660 strategies. Instead of the old approach of @strategy.extend and things that
16661 get converted to strategies, you just build strategies directly.
16662
16663 The old method of defining strategies will still work until Hypothesis 2.0,
16664 because it's a major breaking change, but will now emit deprecation warnings.
16665
16666 The new API is also a lot more powerful as the functions for defining strategies
16667 give you a lot of dials to turn. See :doc:`the updated data section </reference/strategies>` for
16668 details.
16669
16670 Other changes:
16671
16672 * Mixing keyword and positional arguments in a call to @given is deprecated as well.
16673 * There is a new setting called 'strict'. When set to True, Hypothesis will raise
16674 warnings instead of merely printing them. Turning it on by default is inadvisable because
16675 it means that Hypothesis minor releases can break your code, but it may be useful for
16676 making sure you catch all uses of deprecated APIs.
16677 * max_examples in settings is now interpreted as meaning the maximum number
16678 of unique (ish) examples satisfying assumptions. A new setting max_iterations
16679 which defaults to a larger value has the old interpretation.
16680 * Example generation should be significantly faster due to a new faster parameter
16681 selection algorithm. This will mostly show up for simple data types - for complex
16682 ones the parameter selection is almost certainly dominated.
16683 * Simplification has some new heuristics that will tend to cut down on cases
16684 where it could previously take a very long time.
16685 * timeout would previously not have been respected in cases where there were a lot
16686 of duplicate examples. You probably wouldn't have previously noticed this because
16687 max_examples counted duplicates, so this was very hard to hit in a way that mattered.
16688 * A number of internal simplifications to the SearchStrategy API.
16689 * You can now access the current Hypothesis version as hypothesis.__version__.
16690 * A top level function is provided for running the stateful tests without the
16691 TestCase infrastructure.
16692
16693 .. _v1.4.0:
16694
16695 ------------------
16696 1.4.0 - 2015-05-04
16697 ------------------
16698
16699 Codename: What a state.
16700
16701 The *big* feature of this release is the new and slightly experimental
16702 stateful testing API. You can read more about that in :ref:`the appropriate section <stateful>`.
16703
16704 Two minor features the were driven out in the course of developing this:
16705
16706 * You can now set settings.max_shrinks to limit the number of times
16707 Hypothesis will try to shrink arguments to your test. If this is set to
16708 <= 0 then Hypothesis will not rerun your test and will just raise the
16709 failure directly. Note that due to technical limitations if max_shrinks
16710 is <= 0 then Hypothesis will print *every* example it calls your test
16711 with rather than just the failing one. Note also that I don't consider
16712 settings max_shrinks to zero a sensible way to run your tests and it
16713 should really be considered a debug feature.
16714 * There is a new debug level of verbosity which is even *more* verbose than
16715 verbose. You probably don't want this.
16716
16717 Breakage of semi-public SearchStrategy API:
16718
16719 * It is now a required invariant of SearchStrategy that if u simplifies to
16720 v then it is not the case that strictly_simpler(u, v). i.e. simplifying
16721 should not *increase* the complexity even though it is not required to
16722 decrease it. Enforcing this invariant lead to finding some bugs where
16723 simplifying of integers, floats and sets was suboptimal.
16724 * Integers in basic data are now required to fit into 64 bits. As a result
16725 python integer types are now serialized as strings, and some types have
16726 stopped using quite so needlessly large random seeds.
16727
16728 Hypothesis Stateful testing was then turned upon Hypothesis itself, which lead
16729 to an amazing number of minor bugs being found in Hypothesis itself.
16730
16731 Bugs fixed (most but not all from the result of stateful testing) include:
16732
16733 * Serialization of streaming examples was flaky in a way that you would
16734 probably never notice: If you generate a template, simplify it, serialize
16735 it, deserialize it, serialize it again and then deserialize it you would
16736 get the original stream instead of the simplified one.
16737 * If you reduced max_examples below the number of examples already saved in
16738 the database, you would have got a ValueError. Additionally, if you had
16739 more than max_examples in the database all of them would have been
16740 considered.
16741 * @given will no longer count duplicate examples (which it never called
16742 your function with) towards max_examples. This may result in your tests
16743 running slower, but that's probably just because they're trying more
16744 examples.
16745 * General improvements to example search which should result in better
16746 performance and higher quality examples. In particular parameters which
16747 have a history of producing useless results will be more aggressively
16748 culled. This is useful both because it decreases the chance of useless
16749 examples and also because it's much faster to not check parameters which
16750 we were unlikely to ever pick!
16751 * integers_from and lists of types with only one value (e.g. [None]) would
16752 previously have had a very high duplication rate so you were probably
16753 only getting a handful of examples. They now have a much lower
16754 duplication rate, as well as the improvements to search making this
16755 less of a problem in the first place.
16756 * You would sometimes see simplification taking significantly longer than
16757 your defined timeout. This would happen because timeout was only being
16758 checked after each *successful* simplification, so if Hypothesis was
16759 spending a lot of time unsuccessfully simplifying things it wouldn't
16760 stop in time. The timeout is now applied for unsuccessful simplifications
16761 too.
16762 * In Python 2.7, integers_from strategies would have failed during
16763 simplification with an OverflowError if their starting point was at or
16764 near to the maximum size of a 64-bit integer.
16765 * flatmap and map would have failed if called with a function without a
16766 __name__ attribute.
16767 * If max_examples was less than min_satisfying_examples this would always
16768 error. Now min_satisfying_examples is capped to max_examples. Note that
16769 if you have assumptions to satisfy here this will still cause an error.
16770
16771 Some minor quality improvements:
16772
16773 * Lists of streams, flatmapped strategies and basic strategies should now
16774 now have slightly better simplification.
16775
16776 .. _v1.3.0:
16777
16778 ------------------
16779 1.3.0 - 2015-05-22
16780 ------------------
16781
16782 New features:
16783
16784 * New verbosity level API for printing intermediate results and exceptions.
16785 * New specifier for strings generated from a specified alphabet.
16786 * Better error messages for tests that are failing because of a lack of enough
16787 examples.
16788
16789 Bug fixes:
16790
16791 * Fix error where use of ForkingTestCase would sometimes result in too many
16792 open files.
16793 * Fix error where saving a failing example that used flatmap could error.
16794 * Implement simplification for sampled_from, which apparently never supported
16795 it previously. Oops.
16796
16797
16798 General improvements:
16799
16800 * Better range of examples when using one_of or sampled_from.
16801 * Fix some pathological performance issues when simplifying lists of complex
16802 values.
16803 * Fix some pathological performance issues when simplifying examples that
16804 require unicode strings with high codepoints.
16805 * Random will now simplify to more readable examples.
16806
16807
16808 .. _v1.2.1:
16809
16810 ------------------
16811 1.2.1 - 2015-04-16
16812 ------------------
16813
16814 A small patch release for a bug in the new executors feature. Tests which require
16815 doing something to their result in order to fail would have instead reported as
16816 flaky.
16817
16818 .. _v1.2.0:
16819
16820 ------------------
16821 1.2.0 - 2015-04-15
16822 ------------------
16823
16824 Codename: Finders keepers.
16825
16826 A bunch of new features and improvements.
16827
16828 * Provide a mechanism for customizing how your tests are executed.
16829 * Provide a test runner that forks before running each example. This allows
16830 better support for testing native code which might trigger a segfault or a C
16831 level assertion failure.
16832 * Support for using Hypothesis to find examples directly rather than as just as
16833 a test runner.
16834 * New streaming type which lets you generate infinite lazily loaded streams of
16835 data - perfect for if you need a number of examples but don't know how many.
16836 * Better support for large integer ranges. You can now use integers_in_range
16837 with ranges of basically any size. Previously large ranges would have eaten
16838 up all your memory and taken forever.
16839 * Integers produce a wider range of data than before - previously they would
16840 only rarely produce integers which didn't fit into a machine word. Now it's
16841 much more common. This percolates to other numeric types which build on
16842 integers.
16843 * Better validation of arguments to @given. Some situations that would
16844 previously have caused silently wrong behaviour will now raise an error.
16845 * Include +/- sys.float_info.max in the set of floating point edge cases that
16846 Hypothesis specifically tries.
16847 * Fix some bugs in floating point ranges which happen when given
16848 +/- sys.float_info.max as one of the endpoints... (really any two floats that
16849 are sufficiently far apart so that x, y are finite but y - x is infinite).
16850 This would have resulted in generating infinite values instead of ones inside
16851 the range.
16852
16853 .. _v1.1.1:
16854
16855 ------------------
16856 1.1.1 - 2015-04-07
16857 ------------------
16858
16859 Codename: Nothing to see here
16860
16861 This is just a patch release put out because it fixed some internal bugs that would
16862 block the Django integration release but did not actually affect anything anyone could
16863 previously have been using. It also contained a minor quality fix for floats that
16864 I'd happened to have finished in time.
16865
16866 * Fix some internal bugs with object lifecycle management that were impossible to
16867 hit with the previously released versions but broke hypothesis-django.
16868 * Bias floating point numbers somewhat less aggressively towards very small numbers
16869
16870
16871 .. _v1.1.0:
16872
16873 ------------------
16874 1.1.0 - 2015-04-06
16875 ------------------
16876
16877 Codename: No-one mention the M word.
16878
16879 * Unicode strings are more strongly biased towards ascii characters. Previously they
16880 would generate all over the space. This is mostly so that people who try to
16881 shape their unicode strings with assume() have less of a bad time.
16882 * A number of fixes to data deserialization code that could theoretically have
16883 caused mysterious bugs when using an old version of a Hypothesis example
16884 database with a newer version. To the best of my knowledge a change that could
16885 have triggered this bug has never actually been seen in the wild. Certainly
16886 no-one ever reported a bug of this nature.
16887 * Out of the box support for Decimal and Fraction.
16888 * new dictionary specifier for dictionaries with variable keys.
16889 * Significantly faster and higher quality simplification, especially for
16890 collections of data.
16891 * New filter() and flatmap() methods on Strategy for better ways of building
16892 strategies out of other strategies.
16893 * New BasicStrategy class which allows you to define your own strategies from
16894 scratch without needing an existing matching strategy or being exposed to the
16895 full horror or non-public nature of the SearchStrategy interface.
16896
16897
16898 .. _v1.0.0:
16899
16900 ------------------
16901 1.0.0 - 2015-03-27
16902 ------------------
16903
16904 Codename: Blast-off!
16905
16906 There are no code changes in this release. This is precisely the 0.9.2 release
16907 with some updated documentation.
16908
16909 .. _v0.9.2:
16910
16911 ------------------
16912 0.9.2 - 2015-03-26
16913 ------------------
16914
16915 Codename: T-1 days.
16916
16917 * floats_in_range would not actually have produced floats_in_range unless that
16918 range happened to be (0, 1). Fix this.
16919
16920 .. _v0.9.1:
16921
16922 ------------------
16923 0.9.1 - 2015-03-25
16924 ------------------
16925
16926 Codename: T-2 days.
16927
16928 * Fix a bug where if you defined a strategy using map on a lambda then the results would not be saved in the database.
16929 * Significant performance improvements when simplifying examples using lists, strings or bounded integer ranges.
16930
16931 .. _v0.9.0:
16932
16933 ------------------
16934 0.9.0 - 2015-03-23
16935 ------------------
16936
16937 Codename: The final countdown
16938
16939 This release could also be called 1.0-RC1.
16940
16941 It contains a teeny tiny bugfix, but the real point of this release is to declare
16942 feature freeze. There will be zero functionality changes between 0.9.0 and 1.0 unless
16943 something goes really really wrong. No new features will be added, no breaking API changes
16944 will occur, etc. This is the final shakedown before I declare Hypothesis stable and ready
16945 to use and throw a party to celebrate.
16946
16947 Bug bounty for any bugs found between now and 1.0: I will buy you a drink (alcoholic,
16948 caffeinated, or otherwise) and shake your hand should we ever find ourselves in the
16949 same city at the same time.
16950
16951 The one tiny bugfix:
16952
16953 * Under pypy, databases would fail to close correctly when garbage collected, leading to a memory leak and a confusing error message if you were repeatedly creating databases and not closing them. It is very unlikely you were doing this and the chances of you ever having noticed this bug are very low.
16954
16955 .. _v0.7.2:
16956
16957 ------------------
16958 0.7.2 - 2015-03-22
16959 ------------------
16960
16961 Codename: Hygienic macros or bust
16962
16963 * You can now name an argument to @given 'f' and it won't break (:issue:`38`)
16964 * strategy_test_suite is now named strategy_test_suite as the documentation claims and not in fact strategy_test_suitee
16965 * Settings objects can now be used as a context manager to temporarily override the default values inside their context.
16966
16967
16968 .. _v0.7.1:
16969
16970 ------------------
16971 0.7.1 - 2015-03-21
16972 ------------------
16973
16974 Codename: Point releases go faster
16975
16976 * Better string generation by parametrizing by a limited alphabet
16977 * Faster string simplification - previously if simplifying a string with high range unicode characters it would try every unicode character smaller than that. This was pretty pointless. Now it stops after it's a short range (it can still reach smaller ones through recursive calls because of other simplifying operations).
16978 * Faster list simplification by first trying a binary chop down the middle
16979 * Simultaneous simplification of identical elements in a list. So if a bug only triggers when you have duplicates but you drew e.g. [-17, -17], this will now simplify to [0, 0].
16980
16981
16982 .. _v0.7.0,:
16983
16984 -------------------
16985 0.7.0, - 2015-03-20
16986 -------------------
16987
16988 Codename: Starting to look suspiciously real
16989
16990 This is probably the last minor release prior to 1.0. It consists of stability
16991 improvements, a few usability things designed to make Hypothesis easier to try
16992 out, and filing off some final rough edges from the API.
16993
16994 * Significant speed and memory usage improvements
16995 * Add an example() method to strategy objects to give an example of the sort of data that the strategy generates.
16996 * Remove .descriptor attribute of strategies
16997 * Rename descriptor_test_suite to strategy_test_suite
16998 * Rename the few remaining uses of descriptor to specifier (descriptor already has a defined meaning in Python)
16999
17000
17001 .. _v0.6.0:
17002
17003 ---------------------------------------------------------
17004 0.6.0 - 2015-03-13
17005 ---------------------------------------------------------
17006
17007 Codename: I'm sorry, were you using that API?
17008
17009 This is primarily a "simplify all the weird bits of the API" release. As a result there are a lot of breaking changes. If
17010 you just use @given with core types then you're probably fine.
17011
17012 In particular:
17013
17014 * Stateful testing has been removed from the API
17015 * The way the database is used has been rendered less useful (sorry). The feature for reassembling values saved from other
17016 tests doesn't currently work. This will probably be brought back in post 1.0.
17017 * SpecificationMapper is no longer a thing. Instead there is an ExtMethod called strategy which you extend to specify how
17018 to convert other types to strategies.
17019 * Settings are now extensible so you can add your own for configuring a strategy
17020 * MappedSearchStrategy no longer needs an unpack method
17021 * Basically all the SearchStrategy internals have changed massively. If you implemented SearchStrategy directly rather than
17022 using MappedSearchStrategy talk to me about fixing it.
17023 * Change to the way extra packages work. You now specify the package. This
17024 must have a load() method. Additionally any modules in the package will be
17025 loaded in under hypothesis.extra
17026
17027 Bug fixes:
17028
17029 * Fix for a bug where calling falsify on a lambda with a non-ascii character
17030 in its body would error.
17031
17032 Hypothesis Extra:
17033
17034 hypothesis-fakefactory\: An extension for using faker data in hypothesis. Depends
17035 on fake-factory.
17036
17037 .. _v0.5.0:
17038
17039 ------------------
17040 0.5.0 - 2015-02-10
17041 ------------------
17042
17043 Codename: Read all about it.
17044
17045 Core hypothesis:
17046
17047 * Add support back in for pypy and python 3.2
17048 * @given functions can now be invoked with some arguments explicitly provided. If all arguments that hypothesis would have provided are passed in then no falsification is run.
17049 * Related to the above, this means that you can now use pytest fixtures and mark.parametrize with Hypothesis without either interfering with the other.
17050 * Breaking change: @given no longer works for functions with varargs (varkwargs are fine). This might be added back in at a later date.
17051 * Windows is now fully supported. A limited version (just the tests with none of the extras) of the test suite is run on windows with each commit so it is now a first class citizen of the Hypothesis world.
17052 * Fix a bug for fuzzy equality of equal complex numbers with different reprs (this can happen when one coordinate is zero). This shouldn't affect users - that feature isn't used anywhere public facing.
17053 * Fix generation of floats on windows and 32-bit builds of python. I was using some struct.pack logic that only worked on certain word sizes.
17054 * When a test times out and hasn't produced enough examples this now raises a Timeout subclass of Unfalsifiable.
17055 * Small search spaces are better supported. Previously something like a @given(bool, bool) would have failed because it couldn't find enough examples. Hypothesis is now aware of the fact that these are small search spaces and will not error in this case.
17056 * Improvements to parameter search in the case of hard to satisfy assume. Hypothesis will now spend less time exploring parameters that are unlikely to provide anything useful.
17057 * Increase chance of generating "nasty" floats
17058 * Fix a bug that would have caused unicode warnings if you had a sampled_from that was mixing unicode and byte strings.
17059 * Added a standard test suite that you can use to validate a custom strategy you've defined is working correctly.
17060
17061 Hypothesis extra:
17062
17063 First off, introducing Hypothesis extra packages!
17064
17065 These are packages that are separated out from core Hypothesis because they have one or more dependencies. Every
17066 hypothesis-extra package is pinned to a specific point release of Hypothesis and will have some version requirements
17067 on its dependency. They use entry_points so you will usually not need to explicitly import them, just have them installed
17068 on the path.
17069
17070 This release introduces two of them:
17071
17072 hypothesis-datetime:
17073
17074 Does what it says on the tin: Generates datetimes for Hypothesis. Just install the package and datetime support will start
17075 working.
17076
17077 Depends on pytz for timezone support
17078
17079 hypothesis-pytest:
17080
17081 A very rudimentary pytest plugin. All it does right now is hook the display of falsifying examples into pytest reporting.
17082
17083 Depends on pytest.
17084
17085
17086 .. _v0.4.3:
17087
17088 ------------------
17089 0.4.3 - 2015-02-05
17090 ------------------
17091
17092 Codename: TIL narrow Python builds are a thing
17093
17094 This just fixes the one bug.
17095
17096 * Apparently there is such a thing as a "narrow python build" and OS X ships with these by default
17097 for python 2.7. These are builds where you only have two bytes worth of unicode. As a result,
17098 generating unicode was completely broken on OS X. Fix this by only generating unicode codepoints
17099 in the range supported by the system.
17100
17101
17102 .. _v0.4.2:
17103
17104 ------------------
17105 0.4.2 - 2015-02-04
17106 ------------------
17107
17108 Codename: O(dear)
17109
17110 This is purely a bugfix release:
17111
17112 * Provide sensible external hashing for all core types. This will significantly improve
17113 performance of tracking seen examples which happens in literally every falsification
17114 run. For Hypothesis fixing this cut 40% off the runtime of the test suite. The behaviour
17115 is quadratic in the number of examples so if you're running the default configuration
17116 this will be less extreme (Hypothesis's test suite runs at a higher number of examples
17117 than default), but you should still see a significant improvement.
17118 * Fix a bug in formatting of complex numbers where the string could get incorrectly truncated.
17119
17120
17121 .. _v0.4.1:
17122
17123 ------------------
17124 0.4.1 - 2015-02-03
17125 ------------------
17126
17127 Codename: Cruel and unusual edge cases
17128
17129 This release is mostly about better test case generation.
17130
17131 Enhancements:
17132
17133 * Has a cool release name
17134 * text_type (str in python 3, unicode in python 2) example generation now
17135 actually produces interesting unicode instead of boring ascii strings.
17136 * floating point numbers are generated over a much wider range, with particular
17137 attention paid to generating nasty numbers - nan, infinity, large and small
17138 values, etc.
17139 * examples can be generated using pieces of examples previously saved in the
17140 database. This allows interesting behaviour that has previously been discovered
17141 to be propagated to other examples.
17142 * improved parameter exploration algorithm which should allow it to more reliably
17143 hit interesting edge cases.
17144 * Timeout can now be disabled entirely by setting it to any value <= 0.
17145
17146
17147 Bug fixes:
17148
17149 * The descriptor on a OneOfStrategy could be wrong if you had descriptors which
17150 were equal but should not be coalesced. e.g. a strategy for one_of((frozenset({int}), {int}))
17151 would have reported its descriptor as {int}. This is unlikely to have caused you
17152 any problems
17153 * If you had strategies that could produce NaN (which float previously couldn't but
17154 e.g. a Just(float('nan')) could) then this would have sent hypothesis into an infinite
17155 loop that would have only been terminated when it hit the timeout.
17156 * Given elements that can take a long time to minimize, minimization of floats or tuples
17157 could be quadratic or worse in the that value. You should now see much better performance
17158 for simplification, albeit at some cost in quality.
17159
17160 Other:
17161
17162 * A lot of internals have been rewritten. This shouldn't affect you at all, but
17163 it opens the way for certain of hypothesis's oddities to be a lot more extensible by
17164 users. Whether this is a good thing may be up for debate...
17165
17166
17167 .. _v0.4.0:
17168
17169 ------------------
17170 0.4.0 - 2015-01-21
17171 ------------------
17172
17173 FLAGSHIP FEATURE: Hypothesis now persists examples for later use. It stores
17174 data in a local SQLite database and will reuse it for all tests of the same
17175 type.
17176
17177 LICENSING CHANGE: Hypothesis is now released under the Mozilla Public License
17178 2.0. This applies to all versions from 0.4.0 onwards until further notice.
17179 The previous license remains applicable to all code prior to 0.4.0.
17180
17181 Enhancements:
17182
17183 * Printing of failing examples. I was finding that the pytest runner was not
17184 doing a good job of displaying these, and that Hypothesis itself could do
17185 much better.
17186 * Drop dependency on six for cross-version compatibility. It was easy
17187 enough to write the shim for the small set of features that we care about
17188 and this lets us avoid a moderately complex dependency.
17189 * Some improvements to statistical distribution of selecting from small (<=
17190 3 elements)
17191 * Improvements to parameter selection for finding examples.
17192
17193 Bugs fixed:
17194
17195 * could_have_produced for lists, dicts and other collections would not have
17196 examined the elements and thus when using a union of different types of
17197 list this could result in Hypothesis getting confused and passing a value
17198 to the wrong strategy. This could potentially result in exceptions being
17199 thrown from within simplification.
17200 * sampled_from would not work correctly on a single element list.
17201 * Hypothesis could get *very* confused by values which are
17202 equal despite having different types being used in descriptors. Hypothesis
17203 now has its own more specific version of equality it uses for descriptors
17204 and tracking. It is always more fine grained than Python equality: Things
17205 considered != are not considered equal by hypothesis, but some things that
17206 are considered == are distinguished. If your test suite uses both frozenset
17207 and set tests this bug is probably affecting you.
17208
17209 .. _v0.3.2:
17210
17211 ------------------
17212 0.3.2 - 2015-01-16
17213 ------------------
17214
17215 * Fix a bug where if you specified floats_in_range with integer arguments
17216 Hypothesis would error in example simplification.
17217 * Improve the statistical distribution of the floats you get for the
17218 floats_in_range strategy. I'm not sure whether this will affect users in
17219 practice but it took my tests for various conditions from flaky to rock
17220 solid so it at the very least improves discovery of the artificial cases
17221 I'm looking for.
17222 * Improved repr() for strategies and RandomWithSeed instances.
17223 * Add detection for flaky test cases where hypothesis managed to find an
17224 example which breaks it but on the final invocation of the test it does
17225 not raise an error. This will typically happen with too much recursion
17226 errors but could conceivably happen in other circumstances too.
17227 * Provide a "derandomized" mode. This allows you to run hypothesis with
17228 zero real randomization, making your build nice and deterministic. The
17229 tests run with a seed calculated from the function they're testing so you
17230 should still get a good distribution of test cases.
17231 * Add a mechanism for more conveniently defining tests which just sample
17232 from some collection.
17233 * Fix for a really subtle bug deep in the internals of the strategy table.
17234 In some circumstances if you were to define instance strategies for both
17235 a parent class and one or more of its subclasses you would under some
17236 circumstances get the strategy for the wrong superclass of an instance.
17237 It is very unlikely anyone has ever encountered this in the wild, but it
17238 is conceivably possible given that a mix of namedtuple and tuple are used
17239 fairly extensively inside hypothesis which do exhibit this pattern of
17240 strategy.
17241
17242
17243 .. _v0.3.1:
17244
17245 ------------------
17246 0.3.1 - 2015-01-13
17247 ------------------
17248
17249 * Support for generation of frozenset and Random values
17250 * Correct handling of the case where a called function mutates it argument.
17251 This involved introducing a notion of a strategies knowing how to copy
17252 their argument. The default method should be entirely acceptable and the
17253 worst case is that it will continue to have the old behaviour if you
17254 don't mark your strategy as mutable, so this shouldn't break anything.
17255 * Fix for a bug where some strategies did not correctly implement
17256 could_have_produced. It is very unlikely that any of these would have
17257 been seen in the wild, and the consequences if they had been would have
17258 been minor.
17259 * Re-export the @given decorator from the main hypothesis namespace. It's
17260 still available at the old location too.
17261 * Minor performance optimisation for simplifying long lists.
17262
17263
17264 .. _v0.3.0:
17265
17266 ------------------
17267 0.3.0 - 2015-01-12
17268 ------------------
17269
17270 * Complete redesign of the data generation system. Extreme breaking change
17271 for anyone who was previously writing their own SearchStrategy
17272 implementations. These will not work any more and you'll need to modify
17273 them.
17274 * New settings system allowing more global and modular control of Verifier
17275 behaviour.
17276 * Decouple SearchStrategy from the StrategyTable. This leads to much more
17277 composable code which is a lot easier to understand.
17278 * A significant amount of internal API renaming and moving. This may also
17279 break your code.
17280 * Expanded available descriptors, allowing for generating integers or
17281 floats in a specific range.
17282 * Significantly more robust. A very large number of small bug fixes, none
17283 of which anyone is likely to have ever noticed.
17284 * Deprecation of support for pypy and python 3 prior to 3.3. 3.3 and 3.4.
17285 Supported versions are 2.7.x, 3.3.x, 3.4.x. I expect all of these to
17286 remain officially supported for a very long time. I would not be
17287 surprised to add pypy support back in later but I'm not going to do so
17288 until I know someone cares about it. In the meantime it will probably
17289 still work.
17290
17291
17292 .. _v0.2.2:
17293
17294 ------------------
17295 0.2.2 - 2015-01-08
17296 ------------------
17297
17298 * Fix an embarrassing complete failure of the installer caused by my being
17299 bad at version control
17300
17301
17302 .. _v0.2.1:
17303
17304 ------------------
17305 0.2.1 - 2015-01-07
17306 ------------------
17307
17308 * Fix a bug in the new stateful testing feature where you could make
17309 __init__ a @requires method. Simplification would not always work if the
17310 prune method was able to successfully shrink the test.
17311
17312
17313 .. _v0.2.0:
17314
17315 ------------------
17316 0.2.0 - 2015-01-07
17317 ------------------
17318
17319 * It's aliiive.
17320 * Improve python 3 support using six.
17321 * Distinguish between byte and unicode types.
17322 * Fix issues where FloatStrategy could raise.
17323 * Allow stateful testing to request constructor args.
17324 * Fix for issue where test annotations would timeout based on when the
17325 module was loaded instead of when the test started
17326
17327
17328 .. _v0.1.4:
17329
17330 ------------------
17331 0.1.4 - 2013-12-14
17332 ------------------
17333
17334 * Make verification runs time bounded with a configurable timeout
17335
17336
17337 .. _v0.1.3:
17338
17339 ------------------
17340 0.1.3 - 2013-05-03
17341 ------------------
17342
17343 * Bugfix: Stateful testing behaved incorrectly with subclassing.
17344 * Complex number support
17345 * support for recursive strategies
17346 * different error for hypotheses with unsatisfiable assumptions
17347
17348 .. _v0.1.2:
17349
17350 ------------------
17351 0.1.2 - 2013-03-24
17352 ------------------
17353
17354 * Bugfix: Stateful testing was not minimizing correctly and could
17355 throw exceptions.
17356 * Better support for recursive strategies.
17357 * Support for named tuples.
17358 * Much faster integer generation.
17359
17360
17361 .. _v0.1.1:
17362
17363 ------------------
17364 0.1.1 - 2013-03-24
17365 ------------------
17366
17367 * Python 3.x support via 2to3.
17368 * Use new style classes (oops).
17369
17370
17371 .. _v0.1.0:
17372
17373 ------------------
17374 0.1.0 - 2013-03-23
17375 ------------------
17376
17377 * Introduce stateful testing.
17378 * Massive rewrite of internals to add flags and strategies.
17379
17380
17381 .. _v0.0.5:
17382
17383 ------------------
17384 0.0.5 - 2013-03-13
17385 ------------------
17386
17387 * No changes except trying to fix packaging
17388
17389 .. _v0.0.4:
17390
17391 ------------------
17392 0.0.4 - 2013-03-13
17393 ------------------
17394
17395 * No changes except that I checked in a failing test case for 0.0.3
17396 so had to replace the release. Doh
17397
17398 .. _v0.0.3:
17399
17400 ------------------
17401 0.0.3 - 2013-03-13
17402 ------------------
17403
17404 * Improved a few internals.
17405 * Opened up creating generators from instances as a general API.
17406 * Test integration.
17407
17408 .. _v0.0.2:
17409
17410 ------------------
17411 0.0.2 - 2013-03-12
17412 ------------------
17413
17414 * Starting to tighten up on the internals.
17415 * Change API to allow more flexibility in configuration.
17416 * More testing.
17417
17418 .. _v0.0.1:
17419
17420 ------------------
17421 0.0.1 - 2013-03-10
17422 ------------------
17423
17424 * Initial release.
17425 * Basic working prototype. Demonstrates idea, probably shouldn't be used.