File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -322,7 +322,11 @@ def __new__(
322
322
else :
323
323
name = _extract_target_of_assignment (2 )
324
324
if name is None :
325
- raise TypeError ("Name could not be inferred for variable" )
325
+ raise TypeError (
326
+ "Name could not be inferred for variable from surrounding "
327
+ "context. Pass a name explicitly as the first argument to "
328
+ "the Distribution."
329
+ )
326
330
327
331
if not isinstance (name , string_types ):
328
332
raise TypeError (f"Name needs to be a string but got: { name } " )
Original file line number Diff line number Diff line change @@ -433,6 +433,13 @@ def test_autonaming():
433
433
434
434
def test_autonaming_noname ():
435
435
"""Test that autonaming fails if no assignment can be found"""
436
- with pytest .raises (TypeError , match = "Name could not be inferred for variable" ):
436
+ with pytest .raises (
437
+ TypeError ,
438
+ match = (
439
+ "Name could not be inferred for variable from surrounding "
440
+ "context. Pass a name explicitly as the first argument to "
441
+ "the Distribution."
442
+ ),
443
+ ):
437
444
with pm .Model ():
438
445
pm .Normal ()
You can’t perform that action at this time.
0 commit comments