-
Notifications
You must be signed in to change notification settings - Fork 586
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
Add support for variable-width bytes in the IR #4097
Add support for variable-width bytes in the IR #4097
Conversation
I forgot to mention that unfortunately this is a breaking change for alternative backends/providers, as we're changing the provider interface. We could maybe add a dynamic overload based on kwargs on our end if we think it's worthwhile? We'll have to contend with this again when/if we add (cc @pschanely: this pr changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking changes are entirely fine at this point; backends are explicitly unstable and we've warned known downstream both generally in advance and now about this PR. (feels polite to make it a minor release though)
Overall looks great; I'd expect to merge with only minor changes.
hypothesis-python/src/hypothesis/internal/conjecture/datatree.py
Outdated
Show resolved
Hide resolved
hypothesis-python/src/hypothesis/internal/conjecture/shrinking/bytes.py
Outdated
Show resolved
Hide resolved
hypothesis-python/src/hypothesis/strategies/_internal/strings.py
Outdated
Show resolved
Hide resolved
That's what I was hoping to hear 😄. Agree with changing to a minor release 👍. Will return to this pull within a few days. |
(a few days...or now 🙂) @pschanely the interface is now: def draw_string(
self,
intervals: IntervalSet,
*,
min_size: int = 0,
max_size: int = COLLECTION_DEFAULT_MAX_SIZE,
forced: Optional[str] = None,
fake_forced: bool = False,
) -> str:
def draw_bytes(
self,
min_size: int = 0,
max_size: int = COLLECTION_DEFAULT_MAX_SIZE,
*,
forced: Optional[bytes] = None,
fake_forced: bool = False,
) -> bytes: noting that Of course, you're free to change the default for |
Acknowledged! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sweet, let's ship it!
Many changes here were analogous to strings, and I've unified approaches where it made sense.