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