File tree 2 files changed +17
-0
lines changed
src/hypothesis/internal/conjecture 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1614,6 +1614,12 @@ def __init__(
1614
1614
observer = DataObserver ()
1615
1615
if provider_kw is None :
1616
1616
provider_kw = {}
1617
+ elif not isinstance (provider , type ):
1618
+ raise InvalidArgument (
1619
+ f"Expected { provider = } to be a class since { provider_kw = } was "
1620
+ "passed, but got an instance instead."
1621
+ )
1622
+
1617
1623
assert isinstance (observer , DataObserver )
1618
1624
self ._bytes_drawn = 0
1619
1625
self .observer = observer
Original file line number Diff line number Diff line change @@ -595,3 +595,14 @@ def test_function(x):
595
595
with pytest .raises (AssertionError ) as ctx :
596
596
test_function ()
597
597
assert (msg in ctx .value .__notes__ ) == (provider is UnsoundVerifierProvider )
598
+
599
+
600
+ def test_invalid_provider_kw ():
601
+ with pytest .raises (InvalidArgument , match = "got an instance instead" ):
602
+ ConjectureData (
603
+ max_length = 0 ,
604
+ prefix = b"" ,
605
+ random = None ,
606
+ provider = TrivialProvider (None ),
607
+ provider_kw = {"one" : "two" },
608
+ )
You can’t perform that action at this time.
0 commit comments