Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support hypothesis #475

Closed
sobolevn opened this issue Jul 8, 2018 · 14 comments
Closed

Support hypothesis #475

sobolevn opened this issue Jul 8, 2018 · 14 comments
Labels
discussion Discussion enhancement Enhancement proposals hacktoberfest Hacktoberfest 2021 stale

Comments

@sobolevn
Copy link
Collaborator

sobolevn commented Jul 8, 2018

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.

@sobolevn sobolevn added enhancement Enhancement proposals discussion Discussion labels Jul 8, 2018
@lucaswiman
Copy link
Contributor

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'

@stale
Copy link

stale bot commented Dec 14, 2019

This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 14, 2019
@sobolevn sobolevn removed the stale label Dec 14, 2019
@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 2, 2020
@stale
Copy link

stale bot commented Feb 12, 2020

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.

@stale stale bot closed this as completed Feb 12, 2020
@lk-geimfari lk-geimfari reopened this Apr 10, 2020
@stale stale bot removed the stale label Apr 10, 2020
@stale
Copy link

stale bot commented May 30, 2020

This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 30, 2020
@lk-geimfari lk-geimfari reopened this Jun 1, 2020
@stale stale bot removed the stale label Jun 1, 2020
@stale
Copy link

stale bot commented Jul 31, 2020

This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 31, 2020
@stale
Copy link

stale bot commented Aug 15, 2020

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.

@stale stale bot closed this as completed Aug 15, 2020
@lk-geimfari lk-geimfari reopened this Aug 26, 2020
@stale stale bot removed the stale label Aug 26, 2020
@lk-geimfari lk-geimfari added the hacktoberfest Hacktoberfest 2021 label Sep 30, 2020
@stale
Copy link

stale bot commented Nov 29, 2020

This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 29, 2020
@lk-geimfari lk-geimfari reopened this Dec 6, 2020
@stale stale bot removed the stale label Dec 6, 2020
@stale
Copy link

stale bot commented Feb 4, 2021

This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 4, 2021
@lk-geimfari lk-geimfari reopened this Feb 5, 2021
@stale stale bot removed the stale label Feb 5, 2021
@stale
Copy link

stale bot commented Apr 7, 2021

This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 7, 2021
@stale
Copy link

stale bot commented May 5, 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.

@stale stale bot closed this as completed May 5, 2021
@lk-geimfari lk-geimfari reopened this May 5, 2021
@stale stale bot removed the stale label May 5, 2021
@stale
Copy link

stale bot commented Jul 24, 2021

This issue has been automatically marked as stale because it has not had activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 24, 2021
@stale
Copy link

stale bot commented Aug 4, 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.

1 similar comment
@stale
Copy link

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.

@stale stale bot closed this as completed Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discussion enhancement Enhancement proposals hacktoberfest Hacktoberfest 2021 stale
Projects
None yet
Development

No branches or pull requests

3 participants