I need to test a function in python that takes a list with any type of data, from integers to strings to any object a user makes up. Is there a way in hypothesis to generate a list with random objects? I know that I could generate a list of random floats with
@given(strategies.lists(strategies.floats()))
And so on and so forth with integers, chars, etc. But how can I make it so a random list has more than one data type with it?
"hypothesis.strategies.one_of(*args)
: Return a strategy which generates values from any of the argument strategies."
Will it work for you?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With