Skip to content
Snippets Groups Projects
Commit 9ac4f9ec authored by Philip Elson's avatar Philip Elson :snake:
Browse files

JPype 0.7.3+ has changed its exception for invalid overloads again.

parent fbcf7d9b
No related branches found
No related tags found
1 merge request!44Simplify enum testing & unlock JPype version 0.7.3+
......@@ -89,14 +89,19 @@ def test_convert_py_to_val_primitive(japc, jprimitive, expectation):
])
def test_convert_py_to_val_primitive_illegal_argument(japc, jprimitive):
jprimitive = eval(jprimitive)
jp_lt_0p7p1 = jp.__version__ <= "0.7.1"
if JPYPE_LT_0p7:
with pytest.raises(RuntimeError,
match="No matching overloads found for newValue"):
japc._convertPyToVal(jprimitive)
else:
elif jp_lt_0p7p1:
with pytest.raises(jp.JClass('java.lang.IllegalArgumentException'),
match="unsupported type: class java.lang.*"):
japc._convertPyToVal(jprimitive)
else:
with pytest.raises(TypeError,
match="Ambiguous overloads found for"):
japc._convertPyToVal(jprimitive)
@pytest.mark.parametrize(
......@@ -122,7 +127,11 @@ def test_convert_py_to_val_roundtrip_enum(
['NOT_VALID'],
])
def test_invalid_enum(japc, std_meaning_enum_descriptor, to_convert):
with pytest.raises(jp.java.lang.RuntimeException):
if JPYPE_LT_0p7:
raises = pytest.raises(jp.JavaException)
else:
raises = pytest.raises(jp.java.lang.RuntimeException)
with raises:
japc._convertPyToVal(to_convert, std_meaning_enum_descriptor)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment