File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -216,8 +216,6 @@ def __doc__(cls):
216216 return 'Second'
217217 self .assertEqual (A .__doc__ , 'Second' )
218218
219- # TODO: RUSTPYTHON
220- @unittest .expectedFailure
221219 def test_property_set_name_incorrect_args (self ):
222220 p = property ()
223221
Original file line number Diff line number Diff line change 33*/
44use super :: { PyType , PyTypeRef } ;
55use crate :: common:: lock:: PyRwLock ;
6+ use crate :: function:: PosArgs ;
67use crate :: {
78 class:: PyClassImpl ,
89 function:: { FuncArgs , PySetterValue } ,
@@ -122,6 +123,23 @@ impl PyProperty {
122123 * self . doc . write ( ) = value;
123124 }
124125
126+ #[ pymethod( magic) ]
127+ fn set_name ( & self , args : PosArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
128+ let arg_len = args. into_vec ( ) . len ( ) ;
129+
130+ if arg_len != 2 {
131+ Err ( vm. new_exception_msg (
132+ vm. ctx . exceptions . type_error . to_owned ( ) ,
133+ format ! (
134+ "__set_name__() takes 2 positional arguments but {} were given" ,
135+ arg_len
136+ ) ,
137+ ) )
138+ } else {
139+ Ok ( ( ) )
140+ }
141+ }
142+
125143 // Python builder functions
126144
127145 #[ pymethod]
You can’t perform that action at this time.
0 commit comments