Skip to content
This repository has been archived by the owner. It is now read-only.

Add Hypothesis[django] #4

Merged
merged 5 commits into from Oct 9, 2016
Merged

Add Hypothesis[django] #4

merged 5 commits into from Oct 9, 2016

Conversation

jamescooke
Copy link
Owner

@jamescooke jamescooke commented Oct 9, 2016

Use Hypothesis's django extras package and call for an example.

@jamescooke jamescooke force-pushed the james/hypothesis branch 2 times, most recently from b504c2a to 5e3f016 Compare Oct 9, 2016
@jamescooke
Copy link
Owner Author

jamescooke commented Oct 9, 2016

The reason that Hypothesis[django] is RED 🔴 is because model(Item).example() does not reliably generate valid data. There could be two solutions, if either were provided by the library then it would be bumped up to GREEN 💚 ...

Maybe either or both of these exist already and I've missed them - that would be optimal 😄

@DRMacIver
Copy link

DRMacIver commented Oct 9, 2016

You could do model(Item).filter(lambda item: item.full_clean()).

I actually thought this was already happening, but I think maybe that was in a pull request that got abandoned.

@DRMacIver
Copy link

DRMacIver commented Oct 9, 2016

Hmm. Actually that won't work perfectly. There will still be invalid items in the database, but it won't return them from the example.

@jamescooke
Copy link
Owner Author

jamescooke commented Oct 9, 2016

@DRMacIver Thanks for checking this out. I feel sad that this doesn't work with Hypothesis out of the box (yet). Hopefully I'll be able to look some more at Hypothesis[django] and see if there's any quick win that could mean that example(valid=True) could become a reality.

If you find that abandoned PR please stick it on here or tweet it to me - I'd be excited to look it over.

@jamescooke jamescooke merged commit 3b71f0c into master Oct 9, 2016
2 checks passed
@jamescooke jamescooke deleted the james/hypothesis branch Oct 9, 2016
@jamescooke
Copy link
Owner Author

jamescooke commented Oct 12, 2016

Note to self - abandoned PR in Hypothesis is here: HypothesisWorks/hypothesis#335

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants