@@ -303,7 +303,7 @@ mod tests {
303303 "# ,
304304 ) ;
305305
306- assert_snapshot ! ( test. hover( ) , @"
306+ assert_snapshot ! ( test. hover( ) , @r "
307307 def my_func(
308308 a,
309309 b
@@ -358,7 +358,7 @@ mod tests {
358358 "# ,
359359 ) ;
360360
361- assert_snapshot ! ( test. hover( ) , @"
361+ assert_snapshot ! ( test. hover( ) , @r "
362362 def my_func(
363363 a,
364364 b
@@ -427,7 +427,7 @@ mod tests {
427427 "# ,
428428 ) ;
429429
430- assert_snapshot ! ( test. hover( ) , @"
430+ assert_snapshot ! ( test. hover( ) , @r "
431431 <class 'MyClass'>
432432 ---------------------------------------------
433433 This is such a great class!!
@@ -489,7 +489,7 @@ mod tests {
489489 "# ,
490490 ) ;
491491
492- assert_snapshot ! ( test. hover( ) , @"
492+ assert_snapshot ! ( test. hover( ) , @r "
493493 <class 'MyClass'>
494494 ---------------------------------------------
495495 This is such a great class!!
@@ -664,7 +664,7 @@ mod tests {
664664 "# ,
665665 ) ;
666666
667- assert_snapshot ! ( test. hover( ) , @"
667+ assert_snapshot ! ( test. hover( ) , @r "
668668 <class 'MyClass'>
669669 ---------------------------------------------
670670 This is such a great class!!
@@ -729,7 +729,7 @@ mod tests {
729729 "# ,
730730 ) ;
731731
732- assert_snapshot ! ( test. hover( ) , @"
732+ assert_snapshot ! ( test. hover( ) , @r "
733733 bound method MyClass.my_method(
734734 a,
735735 b
@@ -2045,7 +2045,7 @@ def ab(a: int, *, c: int):
20452045 )
20462046 . unwrap ( ) ;
20472047
2048- assert_snapshot ! ( test. hover( ) , @"
2048+ assert_snapshot ! ( test. hover( ) , @r "
20492049 <module 'lib'>
20502050 ---------------------------------------------
20512051 The cool lib_py module!
@@ -2599,7 +2599,7 @@ def function():
25992599 )
26002600 . unwrap ( ) ;
26012601
2602- assert_snapshot ! ( test. hover( ) , @"
2602+ assert_snapshot ! ( test. hover( ) , @r "
26032603 <module 'lib'>
26042604 ---------------------------------------------
26052605 The cool lib_py module!
@@ -2999,7 +2999,7 @@ def function():
29992999 "# ,
30003000 ) ;
30013001
3002- assert_snapshot ! ( test. hover( ) , @"
3002+ assert_snapshot ! ( test. hover( ) , @r "
30033003 int
30043004 ---------------------------------------------
30053005 This is the docs for this value
@@ -3088,7 +3088,7 @@ def function():
30883088 "# ,
30893089 ) ;
30903090
3091- assert_snapshot ! ( test. hover( ) , @"
3091+ assert_snapshot ! ( test. hover( ) , @r "
30923092 int
30933093 ---------------------------------------------
30943094 This is the docs for this value
@@ -4588,6 +4588,115 @@ def function():
45884588 " ) ;
45894589 }
45904590
4591+ #[ test]
4592+ fn hover_multi_inference ( ) {
4593+ let test = cursor_test (
4594+ r#"
4595+ def list1[T](x: T) -> list[T]:
4596+ return [x]
4597+
4598+ def f(x: int, y: int) -> list[int] | list[str]:
4599+ return list1(x<CURSOR> + y)
4600+ "# ,
4601+ ) ;
4602+
4603+ assert_snapshot ! ( test. hover( ) , @r"
4604+ int
4605+ ---------------------------------------------
4606+ ```python
4607+ int
4608+ ```
4609+ ---------------------------------------------
4610+ info[hover]: Hovered content is
4611+ --> main.py:6:18
4612+ |
4613+ 5 | def f(x: int, y: int) -> list[int] | list[str]:
4614+ 6 | return list1(x + y)
4615+ | ^- Cursor offset
4616+ | |
4617+ | source
4618+ |
4619+ " ) ;
4620+
4621+ let test = cursor_test (
4622+ r#"
4623+ def f(x: int, y: int) -> list[int] | list[str]:
4624+ return [x<CURSOR> + y]
4625+ "# ,
4626+ ) ;
4627+
4628+ assert_snapshot ! ( test. hover( ) , @r"
4629+ int
4630+ ---------------------------------------------
4631+ ```python
4632+ int
4633+ ```
4634+ ---------------------------------------------
4635+ info[hover]: Hovered content is
4636+ --> main.py:3:13
4637+ |
4638+ 2 | def f(x: int, y: int) -> list[int] | list[str]:
4639+ 3 | return [x + y]
4640+ | ^- Cursor offset
4641+ | |
4642+ | source
4643+ |
4644+ " ) ;
4645+
4646+ let test = cursor_test (
4647+ r#"
4648+ def list1[T](x: T) -> list[T]:
4649+ return [x]
4650+
4651+ def f(x: int, y: int) -> list[int] | list[str]:
4652+ return (_<CURSOR> := list1(x + y))
4653+ "# ,
4654+ ) ;
4655+
4656+ assert_snapshot ! ( test. hover( ) , @r"
4657+ list[int]
4658+ ---------------------------------------------
4659+ ```python
4660+ list[int]
4661+ ```
4662+ ---------------------------------------------
4663+ info[hover]: Hovered content is
4664+ --> main.py:6:13
4665+ |
4666+ 5 | def f(x: int, y: int) -> list[int] | list[str]:
4667+ 6 | return (_ := list1(x + y))
4668+ | ^- Cursor offset
4669+ | |
4670+ | source
4671+ |
4672+ " ) ;
4673+
4674+ let test = cursor_test (
4675+ r#"
4676+ def f(x: int, y: int) -> list[int] | list[str]:
4677+ return (_<CURSOR> := [x + y])
4678+ "# ,
4679+ ) ;
4680+
4681+ assert_snapshot ! ( test. hover( ) , @r"
4682+ list[int]
4683+ ---------------------------------------------
4684+ ```python
4685+ list[int]
4686+ ```
4687+ ---------------------------------------------
4688+ info[hover]: Hovered content is
4689+ --> main.py:3:13
4690+ |
4691+ 2 | def f(x: int, y: int) -> list[int] | list[str]:
4692+ 3 | return (_ := [x + y])
4693+ | ^- Cursor offset
4694+ | |
4695+ | source
4696+ |
4697+ " ) ;
4698+ }
4699+
45914700 #[ test]
45924701 fn hover_submodule_import_from_use ( ) {
45934702 let test = CursorTest :: builder ( )
0 commit comments