8000 Add test description · pythonnet/pythonnet@cf8ff1f · GitHub
[go: up one dir, main page]

Skip to content

Commit cf8ff1f

Browse files
committed
Add test description
1 parent 4fbf04c commit cf8ff1f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/embed_tests/Codecs.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,22 +339,19 @@ public void ExceptionDecoded()
339339
Assert.AreEqual(TestExceptionMessage, error.Message);
340340
}
341341

342-
[Test]
342+
[Test(Description = "Tests encoding of an object that explicitly implements an interface.")]
343343
public void ExplicitObjectInterfaceEncoded()
344344
{
345345
var obj = new ExplicitInterfaceObject();
346-
347-
// explicitly pass an interface (but not a generic type argument) to simulate a scenario where the type is not know at build time
348-
// var encoder = new InterfaceEncoder(typeof(IObjectInterface));
349-
// PyObjectConversions.RegisterEncoder(encoder);
350-
351346
using var scope = Py.CreateScope();
352347
scope.Exec(@"
353348
def call(obj):
354349
return dir(obj)
355350
");
356351
var callFunc = scope.Get("call");
357-
var members = callFunc.Invoke(obj.ToPythonAs(typeof(IObjectInterface))).As<string[]>();
352+
// explicitly pass an interface (but not a generic type argument) to simulate a scenario where the type is not know at build time
353+
var callArg = obj.ToPythonAs(typeof(IObjectInterface));
354+
var members = callFunc.Invoke(callArg).As<string[]>();
358355
CollectionAssert.Contains(members, nameof(IObjectInterface.MemberFromInterface));
359356
CollectionAssert.DoesNotContain(members, nameof(ExplicitInterfaceObject.MemberFromObject));
360357
}

0 commit comments

Comments
 (0)
0