@@ -13,6 +13,45 @@ def main():
1313 pass
1414"""
1515
16+ NUMPY_DOC = """
17+
18+ import numpy as np
19+ np.sin
20+
21+ """
22+
23+
24+ def test_numpy_hover ():
25+ # Over the blank line
26+ no_hov_position = {'line' : 1 , 'character' : 0 }
27+ # Over 'numpy' in import numpy as np
28+ numpy_hov_position_1 = {'line' : 2 , 'character' : 8 }
29+ # Over 'np' in import numpy as np
30+ numpy_hov_position_2 = {'line' : 2 , 'character' : 17 }
31+ # Over 'np' in np.sin
32+ numpy_hov_position_3 = {'line' : 3 , 'character' : 1 }
33+ # Over 'sin' in np.sin
34+ numpy_sin_hov_position = {'line' : 3 , 'character' : 4 }
35+
36+ doc = Document (DOC_URI , NUMPY_DOC )
37+
38+ if LooseVersion (_utils .JEDI_VERSION ) >= LooseVersion ('0.15.0' ):
39+ contents = ''
40+ assert contents in pyls_hover (doc , no_hov_position )['contents' ]
41+
42+ contents = 'NumPy\n =====\n \n Provides\n '
43+ assert contents in pyls_hover (doc , numpy_hov_position_1 )['contents' ][0 ]
44+
45+ contents = 'NumPy\n =====\n \n Provides\n '
46+ assert contents in pyls_hover (doc , numpy_hov_position_2 )['contents' ][0 ]
47+
48+ contents = 'NumPy\n =====\n \n Provides\n '
49+ assert contents in pyls_hover (doc , numpy_hov_position_3 )['contents' ][0 ]
50+
51+ contents = 'Trigonometric sine, element-wise.\n \n '
52+ assert contents in pyls_hover (
53+ doc , numpy_sin_hov_position )['contents' ][0 ]
54+
1655
1756def test_hover ():
1857 # Over 'main' in def main():
0 commit comments