-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
297398b
commit 4fe6b01
Showing
5 changed files
with
116 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { tExpect } from 'typed-jest-expect'; | ||
import { DiagnosticRule } from '../common/diagnosticRules'; | ||
import { typeAnalyzeSampleFiles, validateResultsButBased } from './testUtils'; | ||
|
||
test('symbol from previous cell', () => { | ||
const analysisResults = typeAnalyzeSampleFiles(['notebook.ipynb']); | ||
tExpect(analysisResults.length).toStrictEqual(2); | ||
validateResultsButBased(analysisResults[0], { | ||
errors: [], | ||
}); | ||
validateResultsButBased(analysisResults[1], { | ||
errors: [ | ||
{ | ||
code: DiagnosticRule.reportAssignmentType, | ||
line: 0, | ||
//TODO: get rid of these stupid fake spaces | ||
message: 'Type "int" is not assignable to declared type "str"\n "int" is not assignable to "str"', | ||
}, | ||
], | ||
}); | ||
}); | ||
|
||
test('non-python cell', () => { | ||
const analysisResults = typeAnalyzeSampleFiles(['notebook2.ipynb']); | ||
tExpect(analysisResults.length).toStrictEqual(0); | ||
}); |
29 changes: 29 additions & 0 deletions
29
packages/pyright-internal/src/tests/samples/notebook.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"foo: int = 1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"bar: str = foo" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/pyright-internal/src/tests/samples/notebook2.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"vscode": { | ||
"languageId": "plaintext" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"asdf" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters