Skip to content

Commit f4852bd

Browse files
committed
make linter happy
1 parent 5f2a88a commit f4852bd

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

cuda_core/tests/test_launcher.py

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -69,39 +69,40 @@ def test_launch_invalid_values(init_cuda):
6969

7070
# Parametrize: (python_type, cpp_type, init_value)
7171
PARAMS = (
72-
(bool, 'bool', True),
73-
(float, 'double', 2.718),
74-
(np.bool, 'bool', True),
75-
(np.int8, 'signed char', -42),
76-
(np.int16, 'signed short', -1234),
77-
(np.int32, 'signed int', -123456),
78-
(np.int64, 'signed long long', -123456789),
79-
(np.uint8, 'unsigned char', 42),
80-
(np.uint16, 'unsigned short', 1234),
81-
(np.uint32, 'unsigned int', 123456),
82-
(np.uint64, 'unsigned long long', 123456789),
83-
(np.float32, 'float', 3.14),
84-
(np.float64, 'double', 2.718),
85-
(ctypes.c_bool, 'bool', True),
86-
(ctypes.c_int8, 'signed char', -42),
87-
(ctypes.c_int16, 'signed short', -1234),
88-
(ctypes.c_int32, 'signed int', -123456),
89-
(ctypes.c_int64, 'signed long long', -123456789),
90-
(ctypes.c_uint8, 'unsigned char', 42),
91-
(ctypes.c_uint16, 'unsigned short', 1234),
92-
(ctypes.c_uint32, 'unsigned int', 123456),
93-
(ctypes.c_uint64, 'unsigned long long', 123456789),
94-
(ctypes.c_float, 'float', 3.14),
95-
(ctypes.c_double, 'double', 2.718),
72+
(bool, "bool", True),
73+
(float, "double", 2.718),
74+
(np.bool, "bool", True),
75+
(np.int8, "signed char", -42),
76+
(np.int16, "signed short", -1234),
77+
(np.int32, "signed int", -123456),
78+
(np.int64, "signed long long", -123456789),
79+
(np.uint8, "unsigned char", 42),
80+
(np.uint16, "unsigned short", 1234),
81+
(np.uint32, "unsigned int", 123456),
82+
(np.uint64, "unsigned long long", 123456789),
83+
(np.float32, "float", 3.14),
84+
(np.float64, "double", 2.718),
85+
(ctypes.c_bool, "bool", True),
86+
(ctypes.c_int8, "signed char", -42),
87+
(ctypes.c_int16, "signed short", -1234),
88+
(ctypes.c_int32, "signed int", -123456),
89+
(ctypes.c_int64, "signed long long", -123456789),
90+
(ctypes.c_uint8, "unsigned char", 42),
91+
(ctypes.c_uint16, "unsigned short", 1234),
92+
(ctypes.c_uint32, "unsigned int", 123456),
93+
(ctypes.c_uint64, "unsigned long long", 123456789),
94+
(ctypes.c_float, "float", 3.14),
95+
(ctypes.c_double, "double", 2.718),
9696
)
9797
if os.environ.get("CUDA_PATH"):
9898
PARAMS += (
99-
(np.float16, 'half', 0.78),
100-
(np.complex64, 'cuda::std::complex<float>', 1+2j),
101-
(np.complex128, 'cuda::std::complex<double>', -3-4j),
102-
(complex, 'cuda::std::complex<double>', 5-7j),
99+
(np.float16, "half", 0.78),
100+
(np.complex64, "cuda::std::complex<float>", 1 + 2j),
101+
(np.complex128, "cuda::std::complex<double>", -3 - 4j),
102+
(complex, "cuda::std::complex<double>", 5 - 7j),
103103
)
104104

105+
105106
@pytest.mark.parametrize("python_type, cpp_type, init_value", PARAMS)
106107
def test_launch_scalar_argument(python_type, cpp_type, init_value):
107108
dev = Device()
@@ -127,13 +128,16 @@ def test_launch_scalar_argument(python_type, cpp_type, init_value):
127128
# Compile and force instantiation for this type
128129
arch = "".join(f"{i}" for i in dev.compute_capability)
129130
if os.environ.get("CUDA_PATH"):
130-
include_path=str(pathlib.Path(os.environ["CUDA_PATH"]) / pathlib.Path("include"))
131-
code = r"""
131+
include_path = str(pathlib.Path(os.environ["CUDA_PATH"]) / pathlib.Path("include"))
132+
code = (
133+
r"""
132134
#include <cuda_fp16.h>
133135
#include <cuda/std/complex>
134-
""" + code
136+
"""
137+
+ code
138+
)
135139
else:
136-
include_path=None
140+
include_path = None
137141
pro_opts = ProgramOptions(std="c++11", arch=f"sm_{arch}", include_path=include_path)
138142
prog = Program(code, code_type="c++", options=pro_opts)
139143
ker_name = f"write_scalar<{cpp_type}>"

0 commit comments

Comments
 (0)