Skip to content

Commit c73e593

Browse files
committed
Applied pre-commit hooks
1 parent d196dc9 commit c73e593

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ repos:
5252
rev: 24.4.2
5353
hooks:
5454
- id: black
55-
args: ["--check", "--diff", "--color"]
55+
args: ["--color"]
5656
- repo: https://github.com/pycqa/isort
5757
rev: 5.13.2
5858
hooks:

tests/third_party/cupy/core_tests/test_core.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import unittest
21
import sys
2+
import unittest
33

44
import numpy
55
import pytest
@@ -35,15 +35,15 @@ def test_size_axis_error(self, dtype):
3535
@testing.numpy_cupy_equal()
3636
@testing.slow
3737
def test_size_huge(self, xp):
38-
a = xp.ndarray(2 ** 32, 'b') # 4 GiB
38+
a = xp.ndarray(2**32, "b") # 4 GiB
3939
return xp.size(a)
4040

4141

4242
_orders = {
4343
order_arg: order_expect
4444
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"]),
4747
]
4848
for order_arg in order_args
4949
}
@@ -55,8 +55,8 @@ class TestOrder(unittest.TestCase):
5555
def test_ndarray(self, order):
5656
order_expect = _orders[order]
5757
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"
6060
assert a.flags.c_contiguous == expect_c
6161
assert a.flags.f_contiguous == expect_f
6262

@@ -92,27 +92,33 @@ def test_cupy_ndarray(self, dtype):
9292
assert cupy.min_scalar_type(v) is arr.dtype
9393

9494

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+
)
98102
@pytest.mark.skip("compiling cupy headers are not supported")
99103
class TestCuPyHeaders(unittest.TestCase):
100104
def setUp(self):
101105
self.temporary_cache_dir_context = test_raw.use_temporary_cache_dir()
102106
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+
)
105110

106111
def tearDown(self):
107112
self.temporary_cache_dir_context.__exit__(*sys.exc_info())
108113

109114
def test_compiling_core_header(self):
110-
code = r'''
115+
code = r"""
111116
extern "C" __global__ void _test_ker_() { }
112-
'''
117+
"""
113118
code = self.header + code
114119
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+
)
117123
ker((1,), (1,), ())
118124
cupy.cuda.Device().synchronize()

0 commit comments

Comments
 (0)