mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 16:06:39 +03:00
Fixed unit tests - needed to add new special case for node child validation logic.
This commit is contained in:
parent
ec4131ea43
commit
01535f8fe8
@ -7,7 +7,7 @@
|
||||
import * as assert from 'assert';
|
||||
|
||||
import { ParseTreeWalker } from '../analyzer/parseTreeWalker';
|
||||
import { AssignmentNode, ParseNode } from '../parser/parseNodes';
|
||||
import { AssignmentNode, ParseNode, StringListNode } from '../parser/parseNodes';
|
||||
|
||||
export class TestWalker extends ParseTreeWalker {
|
||||
constructor() {
|
||||
@ -39,7 +39,7 @@ export class TestWalker extends ParseTreeWalker {
|
||||
children.forEach(child => {
|
||||
let skipCheck = false;
|
||||
|
||||
// There's an exception we need to deal with here. Comment
|
||||
// There are a few exceptions we need to deal with here. Comment
|
||||
// annotations can occur outside of an assignment node's range.
|
||||
if (node instanceof AssignmentNode) {
|
||||
if (child === node.typeAnnotationComment) {
|
||||
@ -47,6 +47,12 @@ export class TestWalker extends ParseTreeWalker {
|
||||
}
|
||||
}
|
||||
|
||||
if (node instanceof StringListNode) {
|
||||
if (child === node.typeAnnotation) {
|
||||
skipCheck = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipCheck) {
|
||||
// Make sure the child is contained within the parent.
|
||||
assert(child.start >= node.start && child.end <= node.end);
|
||||
|
Loading…
Reference in New Issue
Block a user