Skip to content

Commit a5f66b8

Browse files
authored
Merge pull request #4631 from Liam-DeVoe/rename-example
Rename `example` to `test case` in many places
2 parents 14d30c6 + 07bfda4 commit a5f66b8

96 files changed

Lines changed: 668 additions & 521 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_matches_builtin(ls):
2121
assert sorted(ls) == my_sort(ls)
2222
```
2323

24-
This randomized testing can catch bugs and edge cases that you didn't think of and wouldn't have found. In addition, when Hypothesis does find a bug, it doesn't just report any failing example — it reports the simplest possible one. This makes property-based tests a powerful tool for debugging, as well as testing.
24+
This randomized testing can catch bugs and edge cases that you didn't think of and wouldn't have found. In addition, when Hypothesis does find a bug, it doesn't just report any failing test case — it reports the simplest possible one. This makes property-based tests a powerful tool for debugging, as well as testing.
2525

2626
For instance,
2727

@@ -30,10 +30,10 @@ def my_sort(ls):
3030
return sorted(set(ls))
3131
```
3232

33-
fails with the simplest possible failing example:
33+
fails with the simplest possible failing test case:
3434

3535
```
36-
Falsifying example: test_matches_builtin(ls=[0, 0])
36+
Failing test case: test_matches_builtin(ls=[0, 0])
3737
```
3838

3939
### Installation

‎hypothesis/RELEASE.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
RELEASE_TYPE: minor
2+
3+
Hypothesis has historically referred to the single execution of a test function as an "example". However, we have in recent years tended to call a single execution a "test case" instead, which we think is a more precise and less overloaded term.
4+
5+
This release updates user-facing documentation, log messages, and error messages to use the "test case" terminology. Some |observability| fields which contain raw strings from Hypothesis might change in format as a result.
6+
7+
This is not a breaking change, as we have intentionally not changed any code APIs. In particular, |settings.max_examples| has not been changed.

‎hypothesis/docs/_static/better-signatures.css‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎hypothesis/docs/_static/dark-fix.css‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎hypothesis/docs/_static/no-scroll.css‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎hypothesis/docs/_static/styles.css‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* dl gets used both for defining each top-level `.. autofunc` on a page (where we want vertical margsin)
2+
and is wrapped around multiline signatures (where we don't).
3+
If a dl is being used inside a .sig, that's a multiline signature; remove its margins. */
4+
.sig > dl {
5+
margin-block-start: 0rem;
6+
margin-block-end: 0rem;
7+
}
8+
9+
/* with thanks to https://github.com/pradyunsg/furo/discussions/749 */
10+
.sig:not(.sig-inline) {
11+
padding-left: 0.5em;
12+
text-indent: 0;
13+
}
14+
15+
/* override table width restrictions */
16+
/* thanks to https://github.com/readthedocs/sphinx_rtd_theme/issues/117#issuecomment-153083280 */
17+
@media screen and (min-width: 767px) {
18+
19+
.wy-table-responsive table td {
20+
/* !important prevents the common CSS stylesheets from
21+
overriding this as on RTD they are loaded after this stylesheet */
22+
white-space: normal !important;
23+
}
24+
25+
.wy-table-responsive {
26+
overflow: visible !important;
27+
}
28+
29+
}
30+
31+
/* disable autoscroll-to-target behavior
32+
https://github.com/pradyunsg/furo/discussions/384#discussioncomment-2249243 */
33+
html {
34+
scroll-behavior: auto;
35+
}
36+
37+
/*
38+
See https://github.com/HypothesisWorks/hypothesis/issues/4588 and
39+
https://github.com/pradyunsg/furo/discussions/909. Once this is fixed in furo,
40+
we can remove this.
41+
*/
42+
43+
body[data-theme="dark"] .tooltip .tooltip-content {
44+
background-color: var(--color-background-primary);
45+
}
46+
47+
body[data-theme="dark"] .tooltip .arrow {
48+
background: var(--color-background-primary);
49+
}
50+
51+
/*
52+
Furo also renders dark when the theme is "auto" (the default) and the OS
53+
prefers dark, via this same media query. Cover that case too; see
54+
https://github.com/HypothesisWorks/hypothesis/issues/4734.
55+
*/
56+
@media (prefers-color-scheme: dark) {
57+
body:not([data-theme="light"]) .tooltip .tooltip-content {
58+
background-color: var(--color-background-primary);
59+
}
60+
61+
body:not([data-theme="light"]) .tooltip .arrow {
62+
background: var(--color-background-primary);
63+
}
64+
}
65+
66+
a:has(> .std-term),
67+
a:has(> .std-term):hover {
68+
color: inherit;
69+
text-decoration-color: currentColor;
70+
text-decoration-style: dotted;
71+
}

‎hypothesis/docs/_static/wrap-in-tables.css‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎hypothesis/docs/compatibility.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,4 @@ We ship type hints with Hypothesis itself. Though we always try to minimize brea
155155

156156
We may also find more precise ways to describe the type of various interfaces, or change their type and runtime behaviour together in a way which is otherwise backwards-compatible.
157157

158-
There are known issues with inferring the type of examples generated by |st.deferred|, |st.recursive|, |st.one_of|, |st.dictionaries|, and |st.fixed_dictionaries|. We're following proposed updates to Python's typing standards, but unfortunately the long-standing interfaces of these strategies cannot (yet) be statically typechecked.
158+
There are known issues with inferring the type of values generated by |st.deferred|, |st.recursive|, |st.one_of|, |st.dictionaries|, and |st.fixed_dictionaries|. We're following proposed updates to Python's typing standards, but unfortunately the long-standing interfaces of these strategies cannot (yet) be statically typechecked.

‎hypothesis/docs/conf.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"supported": "compatibility.html",
6868
"changes": "changelog.html",
6969
"strategies": "extensions.html",
70+
"explanation/example-count": "test-case-count.html",
7071
# these pages were removed without replacement
7172
"support": "index.html",
7273
"manifesto": "index.html",
@@ -183,6 +184,7 @@ def process_signature(app, what, name, obj, options, signature, return_annotatio
183184
"redis": ("https://redis.readthedocs.io/en/stable/", None),
184185
"attrs": ("https://www.attrs.org/en/stable/", None),
185186
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
187+
"typing": ("https://typing.python.org/en/latest/", None),
186188
"IPython": ("https://ipython.readthedocs.io/en/stable/", None),
187189
"lark": ("https://lark-parser.readthedocs.io/en/stable/", None),
188190
"xarray": ("https://docs.xarray.dev/en/stable/", None),
@@ -221,12 +223,7 @@ def process_signature(app, what, name, obj, options, signature, return_annotatio
221223
# remove "Hypothesis <version> documentation" from just below logo on the sidebar
222224
html_theme_options = {"sidebar_hide_name": True}
223225
html_static_path = ["_static"]
224-
html_css_files = [
225-
"better-signatures.css",
226-
"wrap-in-tables.css",
227-
"no-scroll.css",
228-
"dark-fix.css",
229-
]
226+
html_css_files = ["styles.css"]
230227
htmlhelp_basename = "Hypothesisdoc"
231228
html_favicon = "../../brand/favicon.ico"
232229
html_logo = "../../brand/dragonfly-rainbow-150w.svg"

‎hypothesis/docs/explanation/domain.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ An exact answer depends on both the strategy or strategies for the tests, and th
4040

4141
Hypothesis' default configuration uses a distribution which is tuned to maximize the chance of finding bugs, in as few executions as possible. We explicitly *don't* aim for a uniform distribution, nor for a 'realistic' distribution of inputs; Hypothesis' goal is to search the domain for a failing input as efficiently as possible.
4242

43-
The test case distribution remains an active area of research and development, and we change it whenever we think that would be a net improvement for users. Today, Hypothesis' default distribution is shaped by a wide variety of techniques and heuristics:
43+
The |test case| distribution remains an active area of research and development, and we change it whenever we think that would be a net improvement for users. Today, Hypothesis' default distribution is shaped by a wide variety of techniques and heuristics:
4444

4545
* some are statically designed into strategies - for example, |st.integers| upweights range endpoints, and samples from a mixed distribution over integer bit-widths.
46-
* some are dynamic features of the engine - like replaying prior examples with subsections of the input 'cloned' or otherwise altered, for bugs which trigger only when different fields have the same value (which is otherwise exponentially unlikely).
46+
* some are dynamic features of the engine - like replaying prior test cases with subsections of the input 'cloned' or otherwise altered, for bugs which trigger only when different fields have the same value (which is otherwise exponentially unlikely).
4747
* some vary depending on the code under test - we collect interesting-looking constants from imported source files as seeds for test cases.
4848
* `swarm testing <https://www.cs.utah.edu/~regehr/papers/swarm12.pdf>`__ adds further randomization when choosing which rules to execute in stateful testing.
4949

0 commit comments

Comments
 (0)