File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 16
16
using System . Threading . Tasks ;
17
17
using Microsoft . Python . Analysis . Tests . FluentAssertions ;
18
18
using Microsoft . Python . Analysis . Types ;
19
+ using Microsoft . Python . Analysis . Values ;
19
20
using Microsoft . Python . Parsing . Tests ;
20
21
using Microsoft . VisualStudio . TestTools . UnitTesting ;
21
22
using TestUtilities ;
@@ -51,6 +52,32 @@ public async Task ListAssign() {
51
52
. And . HaveVariable ( "x4" ) . OfType ( BuiltinTypeId . Str ) ;
52
53
}
53
54
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
+
54
81
[ TestMethod , Priority ( 0 ) ]
55
82
public async Task ListCallCtor ( ) {
56
83
const string code = @"
You can’t perform that action at this time.
0 commit comments