|
12 | 12 | ALL_XP = [numpy] |
13 | 13 | try: |
14 | 14 | import cupy |
| 15 | + |
15 | 16 | ALL_XP.append(cupy) |
16 | 17 | except ImportError: |
17 | 18 | pass |
@@ -49,10 +50,12 @@ def test_get_width_fail(obj): |
49 | 50 |
|
50 | 51 | @pytest.mark.parametrize("xp", ALL_XP) |
51 | 52 | def test_array_module_cpu_gpu_helpers(xp): |
52 | | - error = ("Only numpy and cupy arrays are supported" |
53 | | - ", but found <class 'int'> instead. If " |
54 | | - "get_array_module module wasn't called " |
55 | | - "directly, this might indicate a bug in Thinc.") |
| 53 | + error = ( |
| 54 | + "Only numpy and cupy arrays are supported" |
| 55 | + ", but found <class 'int'> instead. If " |
| 56 | + "get_array_module module wasn't called " |
| 57 | + "directly, this might indicate a bug in Thinc." |
| 58 | + ) |
56 | 59 | with pytest.raises(ValueError, match=error): |
57 | 60 | get_array_module(0) |
58 | 61 | zeros = xp.zeros((1, 2)) |
@@ -135,14 +138,10 @@ def test_to_categorical(label_smoothing): |
135 | 138 | ): |
136 | 139 | to_categorical(numpy.asarray([0, 0, 0]), label_smoothing=0.01), |
137 | 140 |
|
138 | | - with pytest.raises( |
139 | | - ValueError, match=r"label_smoothing parameter" |
140 | | - ): |
| 141 | + with pytest.raises(ValueError, match=r"label_smoothing parameter"): |
141 | 142 | to_categorical(numpy.asarray([0, 1, 2, 3, 4]), label_smoothing=0.8) |
142 | 143 |
|
143 | | - with pytest.raises( |
144 | | - ValueError, match=r"label_smoothing parameter" |
145 | | - ): |
| 144 | + with pytest.raises(ValueError, match=r"label_smoothing parameter"): |
146 | 145 | to_categorical(numpy.asarray([0, 1, 2, 3, 4]), label_smoothing=0.88) |
147 | 146 |
|
148 | 147 |
|
|
0 commit comments