Mastering Development

How to create instance of object using reflection for class that have parameter in constructor?

I’m trying to create object using reflection with class that have parameter in constructor. This is what I try for class without constructor. ABC::class.createInstance() ”’ But I have no idea how to do this for class with constructor like ”’ class ABC(a: Int, b: Int) {} ”’

Development Python

python testing using hypothesis : dictionaries with different types of values

I am trying to generate dictionaries containing different python types as values using the hypothesis module. For lists I can do this simply using the expression from hypothesis import given import hypothesis.strategies as st @given( st.lists( st.from_type(type) .flatmap(st.from_type) .filter(lambda x: not isinstance(x, (type(None)))), min_size=2, unique_by=lambda x: type(x), ) ) def test_something(dictionary): … which gives me […]