Comments (5)
It's been five years since I looked into that, but iirc the idea was to avoid automatically generating values for auto-incrementing index fields. If you want that to be generated anyway, you can pass e.g. id_=...
- the field name, and literal ...
as the argument.
If that does in fact solve your problem, I'd prefer to keep the existing behavior because being too 'helpful' has gone wrong here in the past.
from hypothesis.
Sorry, I did a bad job explaining. I actually have the opposite problem...I want hypothesis to not generate a strategy for my id column, but I don't think I can do that. Because I defined the autoid column myself, instead of letting django do it, the "is this a field I should skip" check fails (because field.auto_created
is false, where it's true when django creates the field), and from_model()
calls from_field()
to generate a strategy for it.
A simplified version of the model:
class Group(models.Model):
groupid = models.AutoField(primary_key=True)
from hypothesis.
Oh, I see - yeah, this seems like something I'd be happy to accept a PR for. I guess we could do something like and not (field.auto_created or isinstance(field, AutoField))
? You're more familiar with Django and this use-case than I am, though.
from hypothesis.
This was a fun one...it turns out auto_created
gets set on a bunch of things I didn't realize, so yay for learning new things while trying to fix a different thing.
The cleanest fix seemed to me to be to add in a and not isinstance(field, dm.AutoField)
clause alongside the and not field.auto_created
.
from hypothesis.
closed by #3984
from hypothesis.
Related Issues (20)
- integers strategy can fail with assertion error: `assert min_value is not None`
- memory leak present even in trivial tests HOT 10
- 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 2
- Error when using from_type with optional integers with numeric constraints HOT 8
- Follow up on IR shrinking tasks
- `st.from_regex()` alphabet improvements
- Busy loop randomly runs 6x slower causing flaky DeadlineExceeded errors HOT 5
- Issues with django.forms.ModelChoiceField and ModelMultipleChoiceField HOT 1
- example generation regression between `6.47.0` -> `6.103.1` HOT 1
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.