Skip to content
This repository has been archived by the owner on Feb 1, 2020. 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

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 October 9, 2016 01:23
@jamescooke
Copy link
Owner Author

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

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

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

@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
@jamescooke jamescooke deleted the james/hypothesis branch October 9, 2016 15:51
@jamescooke
Copy link
Owner Author

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
Development

Successfully merging this pull request may close these issues.

2 participants