Skip to content

Commit 4d19d3d

Browse files
committed
add unit test that fails
1 parent bf32986 commit 4d19d3d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_enum.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,18 @@ fn test_renaming_all_enum_variants() {
214214
);
215215
});
216216
}
217+
218+
#[test]
219+
fn test_complex_enum_py_new_into_py() {
220+
#[pyclass]
221+
enum MyEnum {
222+
Variant { i: i32 },
223+
}
224+
225+
Python::with_gil(|py| {
226+
let x = Py::new(py, MyEnum::Variant { i: 42 }).unwrap();
227+
let cls = py.get_type::<MyEnum>();
228+
py_assert!(py, x cls, "isinstance(x, cls)");
229+
py_assert!(py, x cls, "isinstance(x, cls.Variant)");
230+
});
231+
}

0 commit comments

Comments
 (0)