8000 added a regression test for https://github.com/pythonnet/pythonnet/is… · pythonnet/pythonnet@71f6ed9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 71f6ed9

Browse files
committed
added a regression test for #451
1 parent c9626df commit 71f6ed9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/embed_tests/TestConverter.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,31 @@ public void RawPyObjectProxy()
162162
var proxiedHandle = pyObjectProxy.GetAttr("Handle").As<IntPtr>();
163163
Assert.AreEqual(pyObject.Handle, proxiedHandle);
164164
}
165+
166+
// regression for https://github.com/pythonnet/pythonnet/issues/451
167+
[Test]
168+
public void CanGetListFromDerivedClass()
169+
{
170+
using var scope = Py.CreateScope();
171+
scope.Import(typeof(GetListImpl).Namespace, asname: "test");
172+
scope.Exec(@"
173+
class PyGetListImpl(test.GetListImpl):
174+
pass
175+
");
176+
var pyImpl = scope.Get("PyGetListImpl");
177+
dynamic inst = pyImpl.Invoke();
178+
List<string> result = inst.GetList();
179+
CollectionAssert.AreEqual(new[] { "testing" }, result);
180+
}
181+
}
182+
183+
public interface IGetList
184+
{
185+
List<string> GetList();
186+
}
187+
188+
public class GetListImpl : IGetList
189+
{
190+
public List<string> GetList() => new() { "testing" };
165191
}
166192
}

0 commit comments

Comments
 (0)
0