Add changelog entry and test
This commit is contained in:
parent
7b90a9b13e
commit
482ee3a8b2
|
@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
### Changed
|
||||
- Change `PyIterator` to be consistent with other native types: it is now used as `&PyIterator` instead of `PyIterator<'a>`. [#1176](https://github.com/PyO3/pyo3/pull/1176)
|
||||
|
||||
### Removed
|
||||
- Remove unused `python3` feature. [#1209](https://github.com/PyO3/pyo3/pull/1209)
|
||||
|
||||
|
|
|
@ -96,8 +96,7 @@ mod tests {
|
|||
use crate::exceptions::PyTypeError;
|
||||
use crate::gil::GILPool;
|
||||
use crate::types::{PyDict, PyList};
|
||||
use crate::Python;
|
||||
use crate::ToPyObject;
|
||||
use crate::{Python, Py, PyAny, ToPyObject, PyTryFrom};
|
||||
use indoc::indoc;
|
||||
|
||||
#[test]
|
||||
|
@ -199,4 +198,13 @@ mod tests {
|
|||
|
||||
assert!(err.is_instance::<PyTypeError>(py))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn iterator_try_from() {
|
||||
let gil_guard = Python::acquire_gil();
|
||||
let py = gil_guard.python();
|
||||
let obj: Py<PyAny> = vec![10, 20].to_object(py).as_ref(py).iter().unwrap().into();
|
||||
let iter: &PyIterator = PyIterator::try_from(obj.as_ref(py)).unwrap();
|
||||
assert_eq!(obj, iter.into());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue