Comments (4)
(fyi: just reporting, not working on)
from hypothesis.
Unclear what we can do about this, beyond complicating our fast path with support for a broader range of strategies. "Seeing through" a MappedStrategy
is only valid in cases where the transform callable is fairly pure, which means we'd also need an allowlist for that, and I'm just not convinced it's worth it. At some point we have to tell power users to write st.sets(st.sampled_from([your stuff here]))
rather than rewriting it for them.
from hypothesis.
Thanks, and I appreciate your point. I guess the test name (test_efficiently_generates_all_unique_array) got me wound up.
Still: it would be nice for that power user, or the np extra, to be able to derive custom types that are as powerful as the built-in types. A few ideas below, for posterity if this is revisited.
- We don't really need to check purity of the mapping, just repeat the uniqueness check afterwards. A mapping can only narrow the underlying strategy.
- We could even add purity hints for
MappedStrategy
. If we know the mapping is bijective, we don't need to repeat the uniqueness check. While possibly making users feel clever and empowered, I agree this is probably not worth the effort — unless we see other cases. OTOH, it would be simpler than (1) if we limited see-through to bijective mappings. - Simpler would be to add a (possibly private/undocumented) special form of
.map()
. Perhaps anastype=
argument to the strategy. This would be applied immediately to the result of.do_draw()
without deferring to another strategy, and also anywhere these draws are replaced of course.
Anyway, feel free to close.
from hypothesis.
Actually, don't close quite yet. I'll fix it quickly (I think) in the numpy extra.
from hypothesis.
Related Issues (20)
- Adding support for long lists HOT 1
- Add tests for failed validation in Pandas extra
- Using overloaded composite strategies causes `HypothesisDeprecationWarning` HOT 2
- Add `exclude_min/exclude_max` parameters to `decimals` strategy HOT 1
- integers strategy can fail with assertion error: `assert min_value is not None`
- memory leak present even in trivial tests HOT 10
- from_model throws ResolutionFailed for models with user-specified autoincrement id fields HOT 5
- Small optimization in `find_annotated_strategy` HOT 1
- Generation of incorrect values HOT 1
- Fix stack-depth of warning in `@st.composite`
- AssertionError in generate_mutations_from HOT 3
- Hypothesis 6.100.8 introduced a regression in `hypothesis.internal.conjecture.engine.ConjectureRunner` HOT 1
- In `st.from_type()`, handle `typing.Unpack` like `annotated_types.GroupedMetadata`
- PyCon US 2024 sprints! HOT 3
- Tests fail with StopTest (OVERRUN) when generating a random integer (strategies.randoms) HOT 2
- Filter-rewriting for comparisons on dates, times, and datetimes
- `test_drawing_from_recursive_strategy_is_thread_safe` failed on Python 3.13.0b1
- Improve our internal coverage tests HOT 3
- Error when using from_type with optional integers with numeric constraints HOT 8
- Follow up on IR shrinking tasks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hypothesis.