File tree Expand file tree Collapse file tree 3 files changed +25
-25
lines changed Expand file tree Collapse file tree 3 files changed +25
-25
lines changed Original file line number Diff line number Diff line change @@ -399,23 +399,23 @@ fn dtype_via_python_attribute() {
399399 } ) ;
400400}
401401
402- #[ test]
403- fn borrow_from_array_works ( ) {
404- #[ pyclass]
405- struct Owner {
406- array : Array1 < f64 > ,
407- }
402+ #[ pyclass]
403+ struct Owner {
404+ array : Array1 < f64 > ,
405+ }
408406
409- #[ pymethods]
410- impl Owner {
411- #[ getter]
412- fn array ( this : Bound < ' _ , Self > ) -> Bound < ' _ , PyArray1 < f64 > > {
413- let array = & this. borrow ( ) . array ;
407+ #[ pymethods]
408+ impl Owner {
409+ #[ getter]
410+ fn array ( this : Bound < ' _ , Self > ) -> Bound < ' _ , PyArray1 < f64 > > {
411+ let array = & this. borrow ( ) . array ;
414412
415- unsafe { PyArray1 :: borrow_from_array_bound ( array, this. into_any ( ) ) }
416- }
413+ unsafe { PyArray1 :: borrow_from_array_bound ( array, this. into_any ( ) ) }
417414 }
415+ }
418416
417+ #[ test]
418+ fn borrow_from_array_works ( ) {
419419 let array = Python :: with_gil ( |py| {
420420 let owner = Py :: new (
421421 py,
Original file line number Diff line number Diff line change @@ -85,19 +85,19 @@ fn exclusive_borrow_requires_writeable() {
8585 } ) ;
8686}
8787
88- #[ test]
89- #[ should_panic( expected = "AlreadyBorrowed" ) ]
90- fn borrows_span_frames ( ) {
91- #[ pyclass]
92- struct Borrower ;
88+ #[ pyclass]
89+ struct Borrower ;
9390
94- #[ pymethods]
95- impl Borrower {
96- fn shared ( & self , _array : PyReadonlyArray3 < ' _ , f64 > ) { }
91+ #[ pymethods]
92+ impl Borrower {
93+ fn shared ( & self , _array : PyReadonlyArray3 < ' _ , f64 > ) { }
9794
98- fn exclusive ( & self , _array : PyReadwriteArray3 < ' _ , f64 > ) { }
99- }
95+ fn exclusive ( & self , _array : PyReadwriteArray3 < ' _ , f64 > ) { }
96+ }
10097
98+ #[ test]
99+ #[ should_panic( expected = "AlreadyBorrowed" ) ]
100+ fn borrows_span_frames ( ) {
101101 Python :: with_gil ( |py| {
102102 let borrower = Py :: new ( py, Borrower ) . unwrap ( ) ;
103103
Original file line number Diff line number Diff line change @@ -79,12 +79,12 @@ fn from_small_array() {
7979 ( $( $t: ty) +) => {
8080 $( {
8181 Python :: with_gil( |py| {
82- let array: [ $t; 2 ] = [ <$t>:: min_value ( ) , <$t>:: max_value ( ) ] ;
82+ let array: [ $t; 2 ] = [ <$t>:: MIN , <$t>:: MAX ] ;
8383 let pyarray = array. to_pyarray_bound( py) ;
8484
8585 assert_eq!(
8686 pyarray. readonly( ) . as_slice( ) . unwrap( ) ,
87- & [ <$t>:: min_value ( ) , <$t>:: max_value ( ) ]
87+ & [ <$t>:: MIN , <$t>:: MAX ]
8888 ) ;
8989 } ) ;
9090 } ) +
You can’t perform that action at this time.
0 commit comments