| 620 | #[allow(unused_variables)] // when compiling for py2.7 |
| 621 | #[test] |
| 622 | fn test_extract_umlaut() { |
| 623 | let gil = Python::acquire_gil(); |
| 624 | let py = gil.python(); |
| 625 | let py_string = py.eval("u'x=\\u00e4'", None, None).unwrap(); |
| 626 | let data = py_string.cast_as::<PyString>(py).unwrap().data(py); |
| 627 | #[cfg(feature = "python3-sys")] |
| 628 | { |
| 629 | if let PyStringData::Latin1(s) = data { |
| 630 | assert_eq!([b'x', b'=', 0xe4], *s); |
| 631 | } else { |
| 632 | panic!("Expected PyStringData::Latin1"); |
| 633 | } |
| 634 | } |
| 635 | assert_eq!("x=ä", py_string.extract::<String>(py).unwrap()); |
| 636 | } |
| 637 | |
| 638 | #[allow(unused_variables)] // when compiling for py2.7 |
| 639 | #[test] |