Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion astroid/brain/brain_builtin_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,9 @@
except (InferenceError, StopIteration) as exc:
raise UseInferenceDefault from exc
if not isinstance(obj_type, nodes.ClassDef):
raise UseInferenceDefault("TypeError: arg 1 must be class")
raise UseInferenceDefault(

Check warning on line 772 in astroid/brain/brain_builtin_inference.py

View check run for this annotation

Codecov / codecov/patch

astroid/brain/brain_builtin_inference.py#L772

Added line #L772 was not covered by tests
f"TypeError: arg 1 must be class, not {type(obj_type)!r}"
)

# The right hand argument is the class(es) that the given
# object is to be checked against.
Expand Down
4 changes: 3 additions & 1 deletion astroid/brain/brain_namedtuple_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@
# <snippet>
for name in (typename, *attributes):
if not isinstance(name, str):
raise AstroidTypeError("Type names and field names must be strings")
raise AstroidTypeError(

Check warning on line 283 in astroid/brain/brain_namedtuple_enum.py

View check run for this annotation

Codecov / codecov/patch

astroid/brain/brain_namedtuple_enum.py#L283

Added line #L283 was not covered by tests
f"Type names and field names must be strings, not {type(name)!r}"
)
if not name.isidentifier():
raise AstroidValueError(
"Type names and field names must be valid" + f"identifiers: {name!r}"
Expand Down
6 changes: 4 additions & 2 deletions astroid/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@
# issubclass(object, (1, type)) raises TypeError
for klass in class_seq:
if isinstance(klass, util.UninferableBase):
raise AstroidTypeError("arg 2 must be a type or tuple of types")
raise AstroidTypeError(
f"arg 2 must be a type or tuple of types, not {type(klass)!r}"
)

for obj_subclass in obj_type.mro():
if obj_subclass == klass:
Expand Down Expand Up @@ -164,7 +166,7 @@
or its type's mro doesn't work
"""
if not isinstance(node, nodes.ClassDef):
raise TypeError(f"{node} needs to be a ClassDef node")
raise TypeError(f"{node} needs to be a ClassDef node, not {type(node)!r}")

Check warning on line 169 in astroid/helpers.py

View check run for this annotation

Codecov / codecov/patch

astroid/helpers.py#L169

Added line #L169 was not covered by tests
return _object_type_is_subclass(node, class_or_seq, context=context)


Expand Down
2 changes: 1 addition & 1 deletion astroid/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ def _determine_starred_iteration_lookups(

if not isinstance(target, nodes.Tuple):
raise InferenceError(
"Could not make sense of this, the target must be a tuple",
f"Could not make sense of this, the target must be a tuple, not {type(target)!r}",
context=context,
)

Expand Down