8000 Add method object exception tests · pythonnet/pythonnet@17499ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 17499ae

Browse files
committed
Add method object exception tests
1 parent 3770e5c commit 17499ae

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/testing/methodtest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ public static string TestOverloadedObjectTwo(object a, object b)
151151
return "Got object-object";
152152
}
153153

154+
public static string TestOverloadedObjectThree(object a, int b)
155+
{
156+
return "Got object-int";
157+
}
158+
159+
public static string TestOverloadedObjectThree(int a, object b)
160+
{
161+
return "Got int-object";
162+
}
163+
154164
public static bool TestStringOutParams(string s, out string s1)
155165
{
156166
s1 = "output string";

src/tests/test_method.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,3 +806,13 @@ def test_object_in_multiparam():
806806

807807
res = MethodTest.TestOverloadedObjectTwo("foo", "bar")
808808
assert res == "Got object-object"
809+
810+
811+
def test_object_in_multiparam_exception():
812+
"""Test method with object multiparams behaves"""
813+
814+
with pytest.raises(TypeError):
815+
MethodTest.TestOverloadedObjectThree(5, 5)
816+
817+
with pytest.raises(TypeError):
818+
MethodTest.TestOverloadedObjectThree("foo", "bar")

0 commit comments

Comments
 (0)
0