@@ -46,20 +46,18 @@ async def protocol() -> AsyncGenerator[RobotLanguageServerProtocol, None]:
46
46
47
47
@pytest .fixture
48
48
async def test_document () -> AsyncGenerator [TextDocument , None ]:
49
- data = """\
50
- ***Test Cases***
51
- first
52
- Log Hello
53
- """
54
- yield TextDocument (document_uri = "file:///test.robot" , language_id = "robotframework" , version = 1 , text = data )
49
+ data_path = Path (Path (__file__ ).parent , "data/hover.robot" )
50
+ data = data_path .read_text ()
51
+
52
+ yield TextDocument (document_uri = data_path .as_uri (), language_id = "robotframework" , version = 1 , text = data )
55
53
56
54
57
55
@pytest .mark .parametrize (
58
56
("position" ,),
59
57
[
60
- (Position (line = 2 , character = 4 ),),
61
- (Position (line = 2 , character = 5 ),),
62
- (Position (line = 2 , character = 6 ),),
58
+ (Position (line = 9 , character = 4 ),),
59
+ (Position (line = 9 , character = 5 ),),
60
+ (Position (line = 9 , character = 6 ),),
63
61
],
64
62
)
65
63
@pytest .mark .asyncio
@@ -69,17 +67,17 @@ async def test_hover_should_find_simple_keyword(
69
67
70
68
result = await protocol ._robot_hover .collect (protocol .hover , test_document , position )
71
69
assert result
72
- assert result .range == Range (start = Position (line = 2 , character = 4 ), end = Position (line = 2 , character = 7 ))
70
+ assert result .range == Range (start = Position (line = 9 , character = 4 ), end = Position (line = 9 , character = 7 ))
73
71
assert isinstance (result .contents , MarkupContent )
74
72
assert result .contents .kind == MarkupKind .MARKDOWN
75
- assert "Log" in result .contents .value
73
+ assert result .contents .value . startswith ( "#### Log" )
76
74
77
75
78
76
@pytest .mark .parametrize (
79
77
("position" ,),
80
78
[
81
- (Position (line = 2 , character = 3 ),),
82
- (Position (line = 2 , character = 7 ),),
79
+ (Position (line = 9 , character = 3 ),),
80
+ (Position (line = 9 , character = 7 ),),
83
81
],
84
82
)
85
83
@pytest .mark .asyncio
0 commit comments