Skip to content

Commit 30fc662

Browse files
committed
Change test for coverage
Signed-off-by: Facundo Tuesca <[email protected]>
1 parent 0a47aaa commit 30fc662

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/rust/src/declarative_asn1/types.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ mod tests {
309309

310310
use pyo3::IntoPyObject;
311311

312-
use super::{type_to_tag, AnnotatedType, Annotation, Type};
312+
use super::{type_to_tag, AnnotatedType, Annotation, Encoding, Type};
313313

314314
#[test]
315315
// Needed for coverage of `type_to_tag(Type::Option(..))`, since
@@ -318,6 +318,7 @@ mod tests {
318318
pyo3::Python::initialize();
319319

320320
pyo3::Python::attach(|py| {
321+
let encoding = pyo3::Py::new(py, Encoding::Implicit(0)).unwrap();
321322
let ann_type = pyo3::Py::new(
322323
py,
323324
AnnotatedType {
@@ -338,16 +339,17 @@ mod tests {
338339
inner: pyo3::Py::new(py, Type::Option(ann_type)).unwrap(),
339340
annotation: Annotation {
340341
default: None,
341-
encoding: None,
342+
encoding: Some(encoding.clone_ref(py)),
342343
}
343344
.into_pyobject(py)
344345
.unwrap()
345346
.unbind(),
346347
},
347348
)
348349
.unwrap();
349-
let expected_tag = type_to_tag(&Type::Option(optional_type), &None);
350-
assert_eq!(expected_tag, type_to_tag(&Type::PyInt(), &None))
350+
let expected_tag =
351+
type_to_tag(&Type::Option(optional_type), &Some(encoding.clone_ref(py)));
352+
assert_eq!(expected_tag, type_to_tag(&Type::PyInt(), &Some(encoding)))
351353
})
352354
}
353355
}

0 commit comments

Comments
 (0)