question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support hypothesis

See original GitHub issue

There’s a faker plugin to support hypothesis. Sometimes I really need to generate some real-world values from hypothesis for some fields. For example, there’s a trouble with generating URLs for now.

So, we need to create a new library to integrate mimesis and hypothesis together, so I can use mimesis and not faker for these cases.

That’s how it is currently implemented: https://github.com/HypothesisWorks/hypothesis/blob/01864efb809b1d4e9093bcc3a498ac4b30921047/hypothesis-python/src/hypothesis/extra/fakefactory.py

I have to mention that it is not considered a best practice, but it exists.

This issue should be closed after such package is publicly released.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
lucaswimancommented, Feb 15, 2019

I built a simple wrapper that seems to work:

def build_mimesis_strategy(mimesis_provider_class, method_name, *args, **kwargs):
    """
    Get an attribute from a mimesis provider by seeding with a hypothesis-chosen integer.
    """
    provider = mimesis_provider_class()

    def get_value(seed):
        provider.reseed(seed)
        return getattr(provider, method_name)(*args, **kwargs)

    return st.integers().map(get_value)

Then you can do the following:

>>> build_mimesis_strategy = st.build_mimesis_strategy
>>> states = build_mimesis_strategy(mimesis.Address, 'state', abbr=True)
>>> states.example()
'PA'
>>> states.example()
'TN'
>>> states.example()
'WV'
0reactions
stale[bot]commented, Aug 17, 2021

Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support a hypothesis definition and meaning - Collins Dictionary
A hypothesis is an idea which is suggested as a possible explanation for a particular situation or condition, but which has not yet...
Read more >
Support or Reject Null Hypothesis in Easy Steps
Support or reject null hypothesis in general situations. Includes proportions and p-value methods. Easy step-by-step solutions.
Read more >
What is a scientific hypothesis? | Live Science
A scientific hypothesis is a tentative, testable explanation for a phenomenon in the natural world.
Read more >
PostLab SelfGuide Discussion Printable Version - LabWrite
Failure to support hypotheses is common in science, and often serves as a starting point for new experiments. Go back to the statement...
Read more >
Help : Hypothesis
23 Articles. Basic and advanced help for annotating with Hypothesis (LMS or public web app). How to OCR PDFs · Which browsers are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found