File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -1843,8 +1843,6 @@ class C:
1843
1843
'does not support item assignment' ):
1844
1844
fields (C )[0 ].metadata ['test' ] = 3
1845
1845
1846
- # TODO: RUSTPYTHON
1847
- @unittest .expectedFailure
1848
1846
def test_field_metadata_custom_mapping (self ):
1849
1847
# Try a custom mapping.
1850
1848
class SimpleNameSpace :
Original file line number Diff line number Diff line change @@ -93,13 +93,12 @@ impl Constructor for PyMappingProxy {
93
93
) ) ]
94
94
impl PyMappingProxy {
95
95
fn get_inner ( & self , key : PyObjectRef , vm : & VirtualMachine ) -> PyResult < Option < PyObjectRef > > {
96
- let opt = match & self . mapping {
97
- MappingProxyInner :: Class ( class) => key
96
+ match & self . mapping {
97
+ MappingProxyInner :: Class ( class) => Ok ( key
98
98
. as_interned_str ( vm)
99
- . and_then ( |key| class. attributes . read ( ) . get ( key) . cloned ( ) ) ,
100
- MappingProxyInner :: Mapping ( mapping) => mapping. mapping ( ) . subscript ( & * key, vm) . ok ( ) ,
101
- } ;
102
- Ok ( opt)
99
+ . and_then ( |key| class. attributes . read ( ) . get ( key) . cloned ( ) ) ) ,
100
+ MappingProxyInner :: Mapping ( mapping) => mapping. mapping ( ) . subscript ( & * key, vm) . map ( Some ) ,
101
+ }
103
102
}
104
103
105
104
#[ pymethod]
You can’t perform that action at this time.
0 commit comments