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() {
399
399
} ) ;
400
400
}
401
401
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
+ }
408
406
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 ;
414
412
415
- unsafe { PyArray1 :: borrow_from_array_bound ( array, this. into_any ( ) ) }
416
- }
413
+ unsafe { PyArray1 :: borrow_from_array_bound ( array, this. into_any ( ) ) }
417
414
}
415
+ }
418
416
417
+ #[ test]
418
+ fn borrow_from_array_works ( ) {
419
419
let array = Python :: with_gil ( |py| {
420
420
let owner = Py :: new (
421
421
py,
Original file line number Diff line number Diff line change @@ -85,19 +85,19 @@ fn exclusive_borrow_requires_writeable() {
85
85
} ) ;
86
86
}
87
87
88
- #[ test]
89
- #[ should_panic( expected = "AlreadyBorrowed" ) ]
90
- fn borrows_span_frames ( ) {
91
- #[ pyclass]
92
- struct Borrower ;
88
+ #[ pyclass]
89
+ struct Borrower ;
93
90
94
- #[ pymethods]
95
- impl Borrower {
96
- fn shared ( & self , _array : PyReadonlyArray3 < ' _ , f64 > ) { }
91
+ #[ pymethods]
92
+ impl Borrower {
93
+ fn shared ( & self , _array : PyReadonlyArray3 < ' _ , f64 > ) { }
97
94
98
- fn exclusive ( & self , _array : PyReadwriteArray3 < ' _ , f64 > ) { }
99
- }
95
+ fn exclusive ( & self , _array : PyReadwriteArray3 < ' _ , f64 > ) { }
96
+ }
100
97
98
+ #[ test]
99
+ #[ should_panic( expected = "AlreadyBorrowed" ) ]
100
+ fn borrows_span_frames ( ) {
101
101
Python :: with_gil ( |py| {
102
102
let borrower = Py :: new ( py, Borrower ) . unwrap ( ) ;
103
103
Original file line number Diff line number Diff line change @@ -79,12 +79,12 @@ fn from_small_array() {
79
79
( $( $t: ty) +) => {
80
80
$( {
81
81
Python :: with_gil( |py| {
82
- let array: [ $t; 2 ] = [ <$t>:: min_value ( ) , <$t>:: max_value ( ) ] ;
82
+ let array: [ $t; 2 ] = [ <$t>:: MIN , <$t>:: MAX ] ;
83
83
let pyarray = array. to_pyarray_bound( py) ;
84
84
85
85
assert_eq!(
86
86
pyarray. readonly( ) . as_slice( ) . unwrap( ) ,
87
- & [ <$t>:: min_value ( ) , <$t>:: max_value ( ) ]
87
+ & [ <$t>:: MIN , <$t>:: MAX ]
88
88
) ;
89
89
} ) ;
90
90
} ) +
You can’t perform that action at this time.
0 commit comments