Skip to content

Commit

Permalink
Add test for default __repr__
Browse files Browse the repository at this point in the history
  • Loading branch information
jovenlin0527 committed Nov 24, 2021
1 parent 58f1c94 commit 9a1c40c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,13 @@ fn test_enum_arg() {

py_run!(py, f mynum, "f(mynum.Variant)")
}

#[test]
fn test_default_repr_correct() {
Python::with_gil(|py| {
let var1 = Py::new(py, MyEnum::Variant).unwrap();
let var2 = Py::new(py, MyEnum::OtherVariant).unwrap();
py_assert!(py, var1, "repr(var1) == 'MyEnum.Variant'");
py_assert!(py, var2, "repr(var2) == 'MyEnum.OtherVariant'");
})
}

0 comments on commit 9a1c40c

Please sign in to comment.