()
| 750 | |
| 751 | #[test] |
| 752 | fn contains() { |
| 753 | let gil = Python::acquire_gil(); |
| 754 | let py = gil.python(); |
| 755 | |
| 756 | let c = Contains::create_instance(py).unwrap(); |
| 757 | py_run!(py, c, "assert 1 in c"); |
| 758 | py_run!(py, c, "assert -1 not in c"); |
| 759 | py_run!(py, c, "assert 'wrong type' not in c"); |
| 760 | } |
| 761 | |
| 762 | py_class!(class ContainsRef |py| { |
| 763 | def __contains__(&self, item: &str) -> PyResult<bool> { |