Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4f1ce7

Browse files
committed
Checking microsoft#1494
1 parent a34bbaf commit f4f1ce7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/Analysis/Ast/Test/CollectionsTests.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using System.Threading.Tasks;
1717
using Microsoft.Python.Analysis.Tests.FluentAssertions;
1818
using Microsoft.Python.Analysis.Types;
19+
using Microsoft.Python.Analysis.Values;
1920
using Microsoft.Python.Parsing.Tests;
2021
using Microsoft.VisualStudio.TestTools.UnitTesting;
2122
using TestUtilities;
@@ -51,6 +52,32 @@ public async Task ListAssign() {
5152
.And.HaveVariable("x4").OfType(BuiltinTypeId.Str);
5253
}
5354

55+
[TestMethod, Priority(0)]
56+
public async Task TypingListEnum() {
57+
const string code = @"
58+
from typing import List
59+
xs: List[str] = ['tmp']
60+
for x in xs:
61+
pass
62+
";
63+
var analysis = await GetAnalysisAsync(code);
64+
analysis.Should().HaveVariable("x").OfType(BuiltinTypeId.Str);
65+
}
66+
67+
[TestMethod, Priority(0)]
68+
public async Task TypingListInFuncEnum() {
69+
const string code = @"
70+
from typing import List
71+
def f(xs: List[str]):
72+
for x in xs:
73+
pass
74+
";
75+
var analysis = await GetAnalysisAsync(code);
76+
analysis.GlobalScope.Should().OnlyHaveChildScope<Scope>().Which.Should().HaveVariable("x")
77+
.OfType(BuiltinTypeId.Str);
78+
}
79+
80+
5481
[TestMethod, Priority(0)]
5582
public async Task ListCallCtor() {
5683
const string code = @"

0 commit comments

Comments
 (0)