Skip to content

Commit a916eac

Browse files
Fix tests
1 parent 1769cc9 commit a916eac

File tree

1 file changed

+56
-34
lines changed

1 file changed

+56
-34
lines changed

src/test/unittest/inlineValue/pythonInlineValueProvider.unit.test.ts

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,35 @@ suite('Debugging - pythonInlineProvider', () => {
202202
});
203203

204204
test('ProvideInlineValues function should return all the vars in the python file with self in class', async () => {
205+
customRequestStub
206+
.withArgs('variables', sinon.match.any)
207+
.onFirstCall()
208+
.resolves({
209+
variables: [
210+
{
211+
name: 'self',
212+
value: '<__main__.Person object at 0x10b223310>',
213+
type: 'Person',
214+
evaluateName: 'self',
215+
variablesReference: 5,
216+
},
217+
],
218+
});
205219
customRequestStub.withArgs('variables', sinon.match.any).resolves({
206220
variables: [
207221
{
208-
name: 'self',
209-
value: '<__main__.Person object at 0x10b223310>',
210-
type: 'Person',
211-
evaluateName: 'self',
212-
variablesReference: 5,
222+
name: 'name',
223+
value: "'John'",
224+
type: 'str',
225+
evaluateName: 'self.name',
226+
variablesReference: 0,
227+
},
228+
{
229+
name: 'age',
230+
value: '25',
231+
type: 'int',
232+
evaluateName: 'self.age',
233+
variablesReference: 0,
213234
},
214235
],
215236
});
@@ -278,8 +299,8 @@ suite('Debugging - pythonInlineProvider', () => {
278299
expect(result).to.deep.equal(expected);
279300
});
280301

281-
test('ProvideInlineValues function should return all the vars in the python file with class variables', async () => {
282-
customRequestStub.withArgs('variables', sinon.match.any).resolves({
302+
test('ProvideInlineValues function should return the vars in the python file with readable class variables', async () => {
303+
customRequestStub.withArgs('variables', sinon.match.any).onFirstCall().resolves({
283304
variables: [
284305
{
285306
name: 'person1',
@@ -290,6 +311,34 @@ suite('Debugging - pythonInlineProvider', () => {
290311
},
291312
],
292313
});
314+
customRequestStub.withArgs('variables', sinon.match.any).resolves({
315+
variables: [
316+
{
317+
name: 'age',
318+
value: '30',
319+
type: 'int',
320+
evaluateName: 'person1.age',
321+
variablesReference: 0,
322+
},
323+
{
324+
name: 'id',
325+
value: '1',
326+
type: 'int',
327+
evaluateName: 'person1.id',
328+
variablesReference: 0,
329+
},
330+
{
331+
name: 'name',
332+
value: "'John Doe'",
333+
type: 'str',
334+
evaluateName: 'person1.name',
335+
variablesReference: 0,
336+
presentationHint: {
337+
attributes: ['rawString'],
338+
},
339+
},
340+
],
341+
});
293342
const file = path.join(WS_ROOT, 'pythonFiles', 'testClassVarType.py');
294343
let document = await workspace.openTextDocument(file);
295344
const inlineValueProvider = new PythonInlineValueProvider();
@@ -299,33 +348,6 @@ suite('Debugging - pythonInlineProvider', () => {
299348

300349
const result = await inlineValueProvider.provideInlineValues(document, viewPort, context);
301350
const expected = [
302-
{
303-
range: {
304-
c: {
305-
c: 9,
306-
e: 0,
307-
},
308-
e: {
309-
c: 9,
310-
e: 7,
311-
},
312-
},
313-
variableName: 'person1',
314-
caseSensitiveLookup: false,
315-
},
316-
{
317-
range: {
318-
c: {
319-
c: 10,
320-
e: 0,
321-
},
322-
e: {
323-
c: 10,
324-
e: 13,
325-
},
326-
},
327-
expression: 'person1.greet',
328-
},
329351
{
330352
range: {
331353
c: {

0 commit comments

Comments
 (0)