1
- import unittest
2
1
import sys
2
+ import unittest
3
3
4
4
import numpy
5
5
import pytest
@@ -35,15 +35,15 @@ def test_size_axis_error(self, dtype):
35
35
@testing .numpy_cupy_equal ()
36
36
@testing .slow
37
37
def test_size_huge (self , xp ):
38
- a = xp .ndarray (2 ** 32 , 'b' ) # 4 GiB
38
+ a = xp .ndarray (2 ** 32 , "b" ) # 4 GiB
39
39
return xp .size (a )
40
40
41
41
42
42
_orders = {
43
43
order_arg : order_expect
44
44
for order_expect , order_args in [
45
- ('C' , ['C' , 'c' , ' CONTIGUOUS' , '' , None ]),
46
- ('F' , ['F' , 'f' , ' FORTRAN' ]),
45
+ ("C" , ["C" , "c" , " CONTIGUOUS" , "" , None ]),
46
+ ("F" , ["F" , "f" , " FORTRAN" ]),
47
47
]
48
48
for order_arg in order_args
49
49
}
@@ -55,8 +55,8 @@ class TestOrder(unittest.TestCase):
55
55
def test_ndarray (self , order ):
56
56
order_expect = _orders [order ]
57
57
a = core .ndarray ((2 , 3 ), order = order )
58
- expect_c = order_expect == 'C'
59
- expect_f = order_expect == 'F'
58
+ expect_c = order_expect == "C"
59
+ expect_f = order_expect == "F"
60
60
assert a .flags .c_contiguous == expect_c
61
61
assert a .flags .f_contiguous == expect_f
62
62
@@ -92,27 +92,33 @@ def test_cupy_ndarray(self, dtype):
92
92
assert cupy .min_scalar_type (v ) is arr .dtype
93
93
94
94
95
- @testing .parameterize (* testing .product ({
96
- 'cxx' : (None , '--std=c++11' ),
97
- }))
95
+ @testing .parameterize (
96
+ * testing .product (
97
+ {
98
+ "cxx" : (None , "--std=c++11" ),
99
+ }
100
+ )
101
+ )
98
102
@pytest .mark .skip ("compiling cupy headers are not supported" )
99
103
class TestCuPyHeaders (unittest .TestCase ):
100
104
def setUp (self ):
101
105
self .temporary_cache_dir_context = test_raw .use_temporary_cache_dir ()
102
106
self .cache_dir = self .temporary_cache_dir_context .__enter__ ()
103
- self .header = '\n ' .join (['#include <' + h + '>'
104
- for h in core ._cupy_header_list ])
107
+ self .header = "\n " .join (
108
+ ["#include <" + h + ">" for h in core ._cupy_header_list ]
109
+ )
105
110
106
111
def tearDown (self ):
107
112
self .temporary_cache_dir_context .__exit__ (* sys .exc_info ())
108
113
109
114
def test_compiling_core_header (self ):
110
- code = r'''
115
+ code = r"""
111
116
extern "C" __global__ void _test_ker_() { }
112
- '''
117
+ """
113
118
code = self .header + code
114
119
options = () if self .cxx is None else (self .cxx ,)
115
- ker = cupy .RawKernel (code , '_test_ker_' ,
116
- options = options , backend = 'nvrtc' )
120
+ ker = cupy .RawKernel (
121
+ code , "_test_ker_" , options = options , backend = "nvrtc"
122
+ )
117
123
ker ((1 ,), (1 ,), ())
118
124
cupy .cuda .Device ().synchronize ()
0 commit comments