1- using System ;
2- using System . Collections . Generic ;
1+ using FluentAssertions ;
2+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
33using System . Linq ;
4- using System . Text ;
54using System . Threading . Tasks ;
6- using FluentAssertions ;
7- using Microsoft . VisualStudio . TestTools . UnitTesting ;
8- using NSubstitute ;
95using TestUtilities ;
106
117namespace Microsoft . Python . Analysis . Tests {
@@ -27,6 +23,25 @@ public void TestInitialize()
2723 [ TestCleanup ]
2824 public void Cleanup ( ) => TestEnvironmentImpl . TestCleanup ( ) ;
2925
26+ [ DataRow ( GenericSetup + @"
27+ class Map(Generic[]):
28+ def hello():
29+ pass
30+ " ) ]
31+ [ DataRow ( GenericSetup + @"
32+ G = Generic[]
33+ " ) ]
34+ [ DataTestMethod , Priority ( 0 ) ]
35+ public async Task GenericTooFewArguments ( string code ) {
36+ var analysis = await GetAnalysisAsync ( code ) ;
37+ analysis . Diagnostics . Should ( ) . HaveCount ( 1 ) ;
38+
39+ var diagnostic = analysis . Diagnostics . ElementAt ( 0 ) ;
40+ diagnostic . ErrorCode . Should ( ) . Be ( Diagnostics . ErrorCodes . GenericArguments ) ;
41+ diagnostic . Message . Should ( ) . Be ( Resources . GenericTooFewArguments ) ;
42+ }
43+
44+
3045 [ DataRow ( GenericSetup + @"
3146class Map(Generic[T, str]):
3247 def hello():
@@ -43,13 +58,13 @@ def hello():
4358 pass
4459" ) ]
4560 [ DataTestMethod , Priority ( 0 ) ]
46- public async Task GenericArgumentsNotAllTypeParameters ( string code ) {
61+ public async Task GenericNotALlTypParameters ( string code ) {
4762 var analysis = await GetAnalysisAsync ( code ) ;
4863 analysis . Diagnostics . Should ( ) . HaveCount ( 1 ) ;
4964
5065 var diagnostic = analysis . Diagnostics . ElementAt ( 0 ) ;
5166 diagnostic . ErrorCode . Should ( ) . Be ( Diagnostics . ErrorCodes . GenericArguments ) ;
52- diagnostic . Message . Should ( ) . Be ( Resources . GenericArgumentsNotAllTypeParameters ) ;
67+ diagnostic . Message . Should ( ) . Be ( Resources . GenericNotAllTypeParameters ) ;
5368 }
5469
5570 [ DataRow ( GenericSetup + @"
@@ -82,13 +97,13 @@ def hello():
8297 pass
8398" ) ]
8499 [ DataTestMethod , Priority ( 0 ) ]
85- public async Task GenericArgumentsDuplicate ( string code ) {
100+ public async Task GenericDuplicateArguments ( string code ) {
86101 var analysis = await GetAnalysisAsync ( code ) ;
87102 analysis . Diagnostics . Should ( ) . HaveCount ( 1 ) ;
88103
89104 var diagnostic = analysis . Diagnostics . ElementAt ( 0 ) ;
90105 diagnostic . ErrorCode . Should ( ) . Be ( Diagnostics . ErrorCodes . GenericArguments ) ;
91- diagnostic . Message . Should ( ) . Be ( Resources . GenericArgumentsNotAllUnique ) ;
106+ diagnostic . Message . Should ( ) . Be ( Resources . GenericNotAllUnique ) ;
92107 }
93108
94109 [ DataRow ( GenericSetup + @"
0 commit comments