File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -216,10 +216,17 @@ def get_qualname(obj: Any) -> str | None:
216216 )
217217 )
218218 )
219+ qualname_source = "(`obj.__qualname__` > `obj.__name__` > type(obj).__qualname__`)"
219220 if not isinstance (qualname , str ):
220- raise TypeError (f"Expected a string __qualname__, but { obj } had { qualname } ." )
221+ raise TypeError (
222+ f"Expected a string qualname source { qualname_source } , but { obj } had "
223+ f"'{ qualname } '."
224+ )
221225 if len (qualname ) == 0 :
222- raise ValueError (f"Expected a non-empty qualname string for { obj } ." )
226+ raise ValueError (
227+ f"Expected a _non-empty_ string as the qualname source { qualname_source } "
228+ f"for { obj } ."
229+ )
223230 return qualname
224231
225232
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ def test_empty_qualname_raises(self):
193193 Anonymous = type ("" , (), {})
194194 with self .assertRaises (ValueError ) as ctx :
195195 get_qualname (Anonymous )
196- self .assertIn ("Expected a non-empty " , str (ctx .exception ))
196+ self .assertIn ("Expected a _non-empty_ " , str (ctx .exception ))
197197
198198 def test_name_used_when_qualname_absent (self ) -> None :
199199 """Simulates the ufunc pattern: __name__ present, __qualname__ absent."""
You can’t perform that action at this time.
0 commit comments