We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36ebd05 commit d32c3c0Copy full SHA for d32c3c0
src/objectprotocol.rs
@@ -552,4 +552,22 @@ mod test {
552
let obj = py.eval("42", None, None).unwrap();
553
assert_eq!(unsafe { obj.get_type().as_type_ptr() }, obj.get_type_ptr())
554
}
555
+
556
+ #[test]
557
+ fn test_dir() {
558
+ let gil = Python::acquire_gil();
559
+ let py = gil.python();
560
+ let obj = py.eval("42", None, None).unwrap();
561
+ let dir = py
562
+ .eval("dir(42)", None, None)
563
+ .unwrap()
564
+ .extract::<&PyList>()
565
+ .unwrap();
566
+ let a = obj
567
+ .dir()
568
+ .into_iter()
569
+ .map(|x| x.extract::<String>().unwrap());
570
+ let b = dir.into_iter().map(|x| x.extract::<String>().unwrap());
571
+ assert!(a.eq(b));
572
+ }
573
0 commit comments