261def _to_be_didnt_match(expected: Optional[T], actual: T, fmt: LiteralFormat[T]) -> T:
262 call = recordCall(False)
263 writable = _selfieSystem().mode.can_write(expected is None, call, _selfieSystem())
264 if writable:
265 _selfieSystem().write_inline(LiteralValue(expected, actual, fmt), call)
266 return actual
267 else:
268 if expected is None:
269 raise _selfieSystem().fs.assert_failed(
270 f"Can't call `to_be_TODO` in {Mode.readonly} mode!"
271 )
272 else:
273 expectedStr = repr(expected)
274 actualStr = repr(actual)
275 if expectedStr == actualStr:
276 raise ValueError(
277 f"Value of type {type(actual)} is not `==` to the expected value, but they both have the same `repr` value:\n${expectedStr}"
278 )
279 else:
280 raise _selfieSystem().fs.assert_failed(
281 message=_selfieSystem().mode.msg_snapshot_mismatch(
282 expected=expectedStr, actual=actualStr
283 ),
284 expected=expected,
285 actual=actual,
286 )
287
288