Skip to content

Commit

Permalink
Register mapping class in tests/test_proto_methods::mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
aganders3 committed Jun 24, 2022
1 parent 99413a9 commit 6d17012
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/test_proto_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use pyo3::exceptions::{PyAttributeError, PyIndexError, PyValueError};
use pyo3::types::{PyDict, PyList, PyMapping, PySequence, PySlice, PyType};
use pyo3::{prelude::*, py_run, PyCell};
use pyo3::{prelude::*, py_run, PyCell, PyTypeInfo};
use std::{isize, iter};

mod common;
Expand Down Expand Up @@ -210,6 +210,15 @@ impl Mapping {
#[test]
fn mapping() {
Python::with_gil(|py| {
PyModule::import(py, "collections.abc")
.unwrap()
.getattr("Mapping")
.unwrap()
.getattr("register")
.unwrap()
.call1((Mapping::type_object(py),))
.unwrap();

let inst = Py::new(
py,
Mapping {
Expand All @@ -218,7 +227,6 @@ fn mapping() {
)
.unwrap();

//
let mapping: &PyMapping = inst.as_ref(py).downcast().unwrap();

py_assert!(py, inst, "len(inst) == 0");
Expand Down

0 comments on commit 6d17012

Please sign in to comment.