MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / test_extract_umlaut

Function test_extract_umlaut

src/objects/string.rs:622–636  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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]

Callers

nothing calls this directly

Calls 3

pythonMethod · 0.80
evalMethod · 0.80
dataMethod · 0.80

Tested by

no test coverage detected