@@ -22,6 +22,13 @@ suite('Debugging - pythonInlineProvider', () => {
22
22
setup ( ( ) => {
23
23
customRequestStub = sinon . stub ( vscodeapi , 'customRequest' ) ;
24
24
customRequestStub . withArgs ( 'scopes' , sinon . match . any ) . resolves ( { scopes : [ { variablesReference : 0 } ] } ) ;
25
+ } ) ;
26
+
27
+ teardown ( async ( ) => {
28
+ sinon . restore ( ) ;
29
+ } ) ;
30
+
31
+ test ( 'ProvideInlineValues function should return all the vars in the python file' , async ( ) => {
25
32
customRequestStub . withArgs ( 'variables' , sinon . match . any ) . resolves ( {
26
33
variables : [
27
34
{
@@ -71,13 +78,6 @@ suite('Debugging - pythonInlineProvider', () => {
71
78
} ,
72
79
] ,
73
80
} ) ;
74
- } ) ;
75
-
76
- teardown ( async ( ) => {
77
- sinon . restore ( ) ;
78
- } ) ;
79
-
80
- test ( 'ProvideInlineValues function should return all the vars in the python file' , async ( ) => {
81
81
const file = path . join ( WS_ROOT , 'pythonFiles' , 'testVarTypes.py' ) ;
82
82
let document = await workspace . openTextDocument ( file ) ;
83
83
const inlineValueProvider = new PythonInlineValueProvider ( ) ;
@@ -188,4 +188,81 @@ suite('Debugging - pythonInlineProvider', () => {
188
188
] ;
189
189
expect ( result ) . to . deep . equal ( expected ) ;
190
190
} ) ;
191
+
192
+ test ( 'ProvideInlineValues function should return all the vars in the python file with class variables' , async ( ) => {
193
+ customRequestStub . withArgs ( 'variables' , sinon . match . any ) . resolves ( {
194
+ variables : [
195
+ {
196
+ name : 'self' ,
197
+ value : '<__main__.Person object at 0x10b223310>' ,
198
+ type : 'Person' ,
199
+ evaluateName : 'self' ,
200
+ variablesReference : 5 ,
201
+ } ,
202
+ ] ,
203
+ } ) ;
204
+ const file = path . join ( WS_ROOT , 'pythonFiles' , 'testClassVarType.py' ) ;
205
+ let document = await workspace . openTextDocument ( file ) ;
206
+ const inlineValueProvider = new PythonInlineValueProvider ( ) ;
207
+
208
+ const viewPort = new Range ( 0 , 0 , 10 , 0 ) ;
209
+ const context = { frameId : 0 , stoppedLocation : new Range ( 6 , 1 , 6 , 1 ) } as InlineValueContext ;
210
+
211
+ const result = await inlineValueProvider . provideInlineValues ( document , viewPort , context ) ;
212
+ const expected = [
213
+ {
214
+ range : {
215
+ c : {
216
+ c : 2 ,
217
+ e : 8 ,
218
+ } ,
219
+ e : {
220
+ c : 2 ,
221
+ e : 17 ,
222
+ } ,
223
+ } ,
224
+ expression : 'self.name' ,
225
+ } ,
226
+ {
227
+ range : {
228
+ c : {
229
+ c : 3 ,
230
+ e : 8 ,
231
+ } ,
232
+ e : {
233
+ c : 3 ,
234
+ e : 16 ,
235
+ } ,
236
+ } ,
237
+ expression : 'self.age' ,
238
+ } ,
239
+ {
240
+ range : {
241
+ c : {
242
+ c : 6 ,
243
+ e : 18 ,
244
+ } ,
245
+ e : {
246
+ c : 6 ,
247
+ e : 27 ,
248
+ } ,
249
+ } ,
250
+ expression : 'self.name' ,
251
+ } ,
252
+ {
253
+ range : {
254
+ c : {
255
+ c : 6 ,
256
+ e : 29 ,
257
+ } ,
258
+ e : {
259
+ c : 6 ,
260
+ e : 37 ,
261
+ } ,
262
+ } ,
263
+ expression : 'self.age' ,
264
+ } ,
265
+ ] ;
266
+ expect ( result ) . to . deep . equal ( expected ) ;
267
+ } ) ;
191
268
} ) ;
0 commit comments