MCPcopy
hub / github.com/pytest-dev/pytest / _idval_from_value_required

Method _idval_from_value_required

src/_pytest/python.py:1057–1069  ·  view source on GitHub ↗

Like _idval_from_value(), but fails if the type is not supported.

(self, val: object, idx: int)

Source from the content-addressed store, hash-verified

1055 return None
1056
1057 def _idval_from_value_required(self, val: object, idx: int) -> str:
1058 """Like _idval_from_value(), but fails if the type is not supported."""
1059 id = self._idval_from_value(val)
1060 if id is not None:
1061 return id
1062
1063 # Fail.
1064 prefix = self._make_error_prefix()
1065 msg = (
1066 f"{prefix}ids contains unsupported value {saferepr(val)} (type: {type(val)!r}) at index {idx}. "
1067 "Supported types are: str, bytes, int, float, complex, bool, enum, regex or anything with a __name__."
1068 )
1069 fail(msg, pytrace=False)
1070
1071 @staticmethod
1072 def _idval_from_argname(argname: str, idx: int) -> str:

Callers 1

_resolve_idsMethod · 0.95

Calls 3

_idval_from_valueMethod · 0.95
_make_error_prefixMethod · 0.95
safereprFunction · 0.90

Tested by

no test coverage detected