From ad3d7c1e44318d667eb942ee178a2cf41207eb3b Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Fri, 24 Jun 2022 14:09:04 -0400 Subject: [PATCH 1/3] add screenshots --- .../notebook/intellisense/semanticTokens.vscode.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts b/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts index 2a549df9f88..7a2e927a512 100644 --- a/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts +++ b/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts @@ -122,7 +122,7 @@ suite('DataScience - VSCode semantic token tests', function () { assert.deepStrictEqual(actualTokens, expectedTokens, 'Tokens not correct after edit'); }); - test('Special token check', async function () { + test.only('Special token check', async function () { await insertCodeCell( 'import sqllite3 as sql\n\nconn = sql.connect("test.db")\ncur = conn.cursor()\n# BLAH BLAH' ); @@ -150,6 +150,7 @@ suite('DataScience - VSCode semantic token tests', function () { 100, true ); + await captureScreenShot('TokenOk'); // Then get tokens on second cell. const tokens = (await commands.executeCommand( @@ -157,6 +158,7 @@ suite('DataScience - VSCode semantic token tests', function () { cell2.document.uri )) as any; assert.ok(tokens, 'No tokens found on second cell'); + await captureScreenShot('TokenFail'); const expectedTokens: number[] = [1, 0, 4, 14, 1]; const actualTokens: number[] = [...tokens.data]; assert.deepStrictEqual(actualTokens, expectedTokens, 'Expected tokens not returned'); From 3bbc6ffafceeb14016db2b22bacc52e6955bea4e Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Fri, 24 Jun 2022 14:43:44 -0400 Subject: [PATCH 2/3] new way to make document --- .../semanticTokens.vscode.test.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts b/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts index 7a2e927a512..0d4d123b385 100644 --- a/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts +++ b/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts @@ -126,17 +126,21 @@ suite('DataScience - VSCode semantic token tests', function () { await insertCodeCell( 'import sqllite3 as sql\n\nconn = sql.connect("test.db")\ncur = conn.cursor()\n# BLAH BLAH' ); - await insertCodeCell('\n'); + await insertCodeCell( + '\ndata = [\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n]', + { index: 1 } + ); + // await insertCodeCell('\n'); const cell1 = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(0)!; const cell2 = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(1)!; - const editor = window.visibleTextEditors.find((e) => e.document.uri === cell2.document.uri); - await editor?.edit((b) => { - b.insert( - new Position(1, 0), - 'data = [\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n]' - ); - }); + // const editor = window.visibleTextEditors.find((e) => e.document.uri === cell2.document.uri); + // await editor?.edit((b) => { + // b.insert( + // new Position(1, 0), + // 'data = [\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n]' + // ); + // }); // Wait for tokens on the first cell (it works with just plain pylance) await waitForCondition( From 597ec78db321089e3c9d4f67eec40bf56a8b6276 Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Fri, 24 Jun 2022 15:03:15 -0400 Subject: [PATCH 3/3] remove logging and add news --- news/3 Code Health/10565.md | 1 + .../intellisense/semanticTokens.vscode.test.ts | 13 +------------ 2 files changed, 2 insertions(+), 12 deletions(-) create mode 100644 news/3 Code Health/10565.md diff --git a/news/3 Code Health/10565.md b/news/3 Code Health/10565.md new file mode 100644 index 00000000000..f7d9aa17610 --- /dev/null +++ b/news/3 Code Health/10565.md @@ -0,0 +1 @@ +Fix 'Special Token Check' test. \ No newline at end of file diff --git a/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts b/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts index 0d4d123b385..9541819ffd4 100644 --- a/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts +++ b/src/test/datascience/notebook/intellisense/semanticTokens.vscode.test.ts @@ -122,7 +122,7 @@ suite('DataScience - VSCode semantic token tests', function () { assert.deepStrictEqual(actualTokens, expectedTokens, 'Tokens not correct after edit'); }); - test.only('Special token check', async function () { + test('Special token check', async function () { await insertCodeCell( 'import sqllite3 as sql\n\nconn = sql.connect("test.db")\ncur = conn.cursor()\n# BLAH BLAH' ); @@ -130,18 +130,9 @@ suite('DataScience - VSCode semantic token tests', function () { '\ndata = [\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n]', { index: 1 } ); - // await insertCodeCell('\n'); const cell1 = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(0)!; const cell2 = vscodeNotebook.activeNotebookEditor?.notebook.cellAt(1)!; - // const editor = window.visibleTextEditors.find((e) => e.document.uri === cell2.document.uri); - // await editor?.edit((b) => { - // b.insert( - // new Position(1, 0), - // 'data = [\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n ("name", "John", "age", 30)\n]' - // ); - // }); - // Wait for tokens on the first cell (it works with just plain pylance) await waitForCondition( async () => { @@ -154,7 +145,6 @@ suite('DataScience - VSCode semantic token tests', function () { 100, true ); - await captureScreenShot('TokenOk'); // Then get tokens on second cell. const tokens = (await commands.executeCommand( @@ -162,7 +152,6 @@ suite('DataScience - VSCode semantic token tests', function () { cell2.document.uri )) as any; assert.ok(tokens, 'No tokens found on second cell'); - await captureScreenShot('TokenFail'); const expectedTokens: number[] = [1, 0, 4, 14, 1]; const actualTokens: number[] = [...tokens.data]; assert.deepStrictEqual(actualTokens, expectedTokens, 'Expected tokens not returned');