Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit ecaf88c

Browse files
committed
Port test from microsoft#312 to new analysis
1 parent 9116b93 commit ecaf88c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Analysis/Ast/Test/InheritanceTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
// See the Apache Version 2.0 License for specific language governing
1414
// permissions and limitations under the License.
1515

16+
using System.Linq;
1617
using System.Threading.Tasks;
18+
using FluentAssertions;
1719
using Microsoft.Python.Analysis.Tests.FluentAssertions;
1820
using Microsoft.Python.Analysis.Types;
21+
using Microsoft.Python.Analysis.Values;
1922
using Microsoft.VisualStudio.TestTools.UnitTesting;
2023
using TestUtilities;
2124

@@ -92,5 +95,23 @@ def foo(self, x):
9295

9396
analysis.Should().HaveVariable("y").OfType(BuiltinTypeId.Int);
9497
}
98+
99+
100+
[TestMethod, Priority(0)]
101+
public async Task NamedTupleSubclass() {
102+
const string code = @"
103+
import collections
104+
105+
class A(collections.namedtuple('A', [])):
106+
def __new__(cls):
107+
return super(A, cls).__new__(cls)
108+
109+
a = A()
110+
";
111+
var analysis = await GetAnalysisAsync(code);
112+
analysis.Should().HaveVariable("a")
113+
.Which.Value.Should().BeAssignableTo<IPythonInstance>()
114+
.Which.Type.Name.Should().Be("A");
115+
}
95116
}
96117
}

0 commit comments

Comments
 (0)