CodyKochmann
4/25/2017 - 7:58 PM

generates random garbage that you can throw at functions for testing!

generates random garbage that you can throw at functions for testing!

from random import choice
from hypothesis import strategies as st

def garbage(how_much_garbage=64):
    """ generate random garbage that you can throw at functions for testing! 
        by: Cody Kochmann
    """
    strats=[
        st.binary(),
        st.booleans(),
        st.characters(),
        st.complex_numbers(),
        st.decimals(),
        st.floats(),
        st.fractions(),
        st.integers(),
        st.none(),
        st.random_module(),
        st.randoms(),
        st.text(),
        st.tuples(),
        st.uuids()]
    while how_much_garbage:
        how_much_garbage-=1
        yield choice(strats).example()