From 9d8a4c005789d64cf5cd6cdb8abf051730c7703f Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 30 Sep 2024 16:12:26 -0500 Subject: [PATCH] Improve display of `assert_public_ty` assertion failures (#13577) While working on https://github.com/astral-sh/ruff/pull/13576 I noticed that it was really hard to tell which assertion failed in some of these test cases. This could be expanded to elsewhere, but I've heard this test suite format won't be around for long? --- crates/red_knot_python_semantic/src/types/infer.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/red_knot_python_semantic/src/types/infer.rs b/crates/red_knot_python_semantic/src/types/infer.rs index 0652f1ac77..cbd57540fe 100644 --- a/crates/red_knot_python_semantic/src/types/infer.rs +++ b/crates/red_knot_python_semantic/src/types/infer.rs @@ -2948,7 +2948,11 @@ mod tests { let file = system_path_to_file(db, file_name).expect("Expected file to exist."); let ty = global_symbol_ty(db, file, symbol_name); - assert_eq!(ty.display(db).to_string(), expected); + assert_eq!( + ty.display(db).to_string(), + expected, + "Mismatch for symbol '{symbol_name}' in '{file_name}'" + ); } fn assert_scope_ty(