| 50 | |
| 51 | #[test] |
| 52 | fn empty_class_in_module() { |
| 53 | let gil = Python::acquire_gil(); |
| 54 | let py = gil.python(); |
| 55 | let module = PyModule::new(py, "test_module.nested").unwrap(); |
| 56 | module.add_class::<EmptyClassInModule>(py).unwrap(); |
| 57 | |
| 58 | let ty = module.get(py, "EmptyClassInModule").unwrap(); |
| 59 | assert_eq!( |
| 60 | ty.getattr(py, "__name__") |
| 61 | .unwrap() |
| 62 | .extract::<String>(py) |
| 63 | .unwrap(), |
| 64 | "EmptyClassInModule" |
| 65 | ); |
| 66 | assert_eq!( |
| 67 | ty.getattr(py, "__module__") |
| 68 | .unwrap() |
| 69 | .extract::<String>(py) |
| 70 | .unwrap(), |
| 71 | "test_module.nested" |
| 72 | ); |
| 73 | } |
| 74 | |
| 75 | py_class!(class EmptyClassWithNew |py| { |
| 76 | def __new__(_cls) -> PyResult<EmptyClassWithNew> { |