Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit da620b4

Browse files
author
MikhailArkhipov
committed
Test fixes
1 parent 2ee4d06 commit da620b4

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

src/Analysis/Engine/Impl/Values/BoundMethodInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public override IAnalysisSet Call(Node node, AnalysisUnit unit, IAnalysisSet[] a
4646
public override IPythonProjectEntry DeclaringModule => Function.DeclaringModule;
4747
public override int DeclaringVersion => Function.DeclaringVersion;
4848
public override IEnumerable<ILocationInfo> Locations => Function.Locations;
49+
public override BuiltinTypeId TypeId => BuiltinTypeId.Function;
4950

5051
public IEnumerable<KeyValuePair<string, string>> GetRichDescription() {
5152
if (Push()) {

src/Analysis/Engine/Impl/Values/BuiltinMethodInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public override string Documentation {
9898
return _doc;
9999
}
100100
}
101-
101+
public override BuiltinTypeId TypeId => BuiltinTypeId.BuiltinFunction;
102102
public override PythonMemberType MemberType => _memberType;
103103
public override string Name => _function.Name;
104104
public override ILocatedMember GetLocatedMember() => _function as ILocatedMember;

src/Analysis/Engine/Test/AnalysisTest.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2423,7 +2423,7 @@ def __invert__(self):
24232423

24242424

24252425
[TestMethod, Priority(0)]
2426-
public async Task TrueDividePython3X() {
2426+
public async Task TrueDividePython35() {
24272427
var text = @"
24282428
class C:
24292429
def __truediv__(self, other):
@@ -2443,6 +2443,27 @@ def __rtruediv__(self, other):
24432443
}
24442444
}
24452445

2446+
[TestMethod, Priority(0)]
2447+
public async Task TrueDividePython36() {
2448+
var text = @"
2449+
class C:
2450+
def __truediv__(self, other):
2451+
return 42
2452+
def __rtruediv__(self, other):
2453+
return 3.0
2454+
2455+
a = C()
2456+
b = a / 'abc'
2457+
c = 'abc' / a
2458+
";
2459+
2460+
using (var server = await CreateServerAsync(PythonVersions.Required_Python36X)) {
2461+
var analysis = await server.OpenDefaultDocumentAndGetAnalysisAsync(text);
2462+
analysis.Should().HaveVariable("b").OfType(BuiltinTypeId.Int)
2463+
.And.HaveVariable("c").OfType(BuiltinTypeId.Float);
2464+
}
2465+
}
2466+
24462467
[TestMethod, Priority(0)]
24472468
public async Task BinaryOperators() {
24482469
var operators = new[] {

src/Analysis/Engine/Test/InheritanceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def virt():
3636
using (var server = await new Server().InitializeAsync(PythonVersions.Required_Python36X)) {
3737
var analysis = await server.OpenDefaultDocumentAndGetAnalysisAsync(code);
3838

39-
analysis.Should().HaveVariable("b").OfType(BuiltinTypeId.Int);
39+
analysis.Should().HaveVariable("b").OfTypes(BuiltinTypeId.Int);
4040
}
4141
}
4242

@@ -61,7 +61,7 @@ def virt():
6161
using (var server = await new Server().InitializeAsync(PythonVersions.Required_Python36X)) {
6262
var analysis = await server.OpenDefaultDocumentAndGetAnalysisAsync(code);
6363

64-
analysis.Should().HaveVariable("b").OfType(BuiltinTypeId.Int);
64+
analysis.Should().HaveVariable("b").OfTypes(BuiltinTypeId.Int, BuiltinTypeId.Function);
6565
}
6666
}
6767
}

0 commit comments

Comments
 (0)