Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Example to Span #4292

Merged
merged 3 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion guides/strategies-that-shrink.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Explicit example boundaries
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is almost always handled implicitly, e.g. by ``cu.many``, but *sometimes*
it can be useful to explicitly insert boundaries around draws that should be
deleted simultaneously using ``data.start_example``. This is used to group
deleted simultaneously using ``data.start_span``. This is used to group
the value and sign of floating-point numbers, for example, which we split up
in order to provide a more natural shrinking order.

Expand Down
3 changes: 3 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RELEASE_TYPE: patch

Rename a few internal classes for clarity.
4 changes: 2 additions & 2 deletions hypothesis-python/src/hypothesis/extra/lark.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ def draw_symbol(
draw_state.append(data.draw(strategy))
else:
assert isinstance(symbol, NonTerminal)
data.start_example(self.rule_label(symbol.name))
data.start_span(self.rule_label(symbol.name))
expansion = data.draw(self.nonterminal_strategies[symbol.name])
for e in expansion:
self.draw_symbol(data, e, draw_state)
self.gen_ignore(data, draw_state)
data.stop_example()
data.stop_span()

def gen_ignore(self, data: ConjectureData, draw_state: list[str]) -> None:
if self.ignored_symbols and data.draw_boolean(1 / 4):
Expand Down
Loading