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 } ,
@@ -154,6 +155,23 @@ impl PyProperty {
154155 * self . doc . write ( ) = value;
155156 }
156157
158+ #[ pymethod( magic) ]
159+ fn set_name ( & self , args : PosArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
160+ let arg_len = args. into_vec ( ) . len ( ) ;
161+
162+ if arg_len != 2 {
163+ Err ( vm. new_exception_msg (
164+ vm. ctx . exceptions . type_error . to_owned ( ) ,
165+ format ! (
166+ "__set_name__() takes 2 positional arguments but {} were given" ,
167+ arg_len
168+ ) ,
169+ ) )
170+ } else {
171+ Ok ( ( ) )
172+ }
173+ }
174+
157175 // Python builder functions
158176
159177 #[ pymethod]
You can’t perform that action at this time.
0 commit comments