Skip to content

Commit

Permalink
Auto-format code with black (#723)
Browse files Browse the repository at this point in the history
Co-authored-by: explosion-bot <explosion-bot@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and explosion-bot authored Jul 8, 2022
1 parent eb5c38b commit 5508f53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion thinc/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

# Functionally disable deadline settings for tests
# to prevent spurious test failures in CI builds.
settings.register_profile("no_deadlines", deadline=2*60*1000) # in ms
settings.register_profile("no_deadlines", deadline=2 * 60 * 1000) # in ms
settings.load_profile("no_deadlines")


def pytest_sessionstart(session):
# If Tensorflow is installed, attempt to enable memory growth
# to prevent it from allocating all of the GPU's free memory
Expand Down
19 changes: 9 additions & 10 deletions thinc/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ALL_XP = [numpy]
try:
import cupy

ALL_XP.append(cupy)
except ImportError:
pass
Expand Down Expand Up @@ -49,10 +50,12 @@ def test_get_width_fail(obj):

@pytest.mark.parametrize("xp", ALL_XP)
def test_array_module_cpu_gpu_helpers(xp):
error = ("Only numpy and cupy arrays are supported"
", but found <class 'int'> instead. If "
"get_array_module module wasn't called "
"directly, this might indicate a bug in Thinc.")
error = (
"Only numpy and cupy arrays are supported"
", but found <class 'int'> instead. If "
"get_array_module module wasn't called "
"directly, this might indicate a bug in Thinc."
)
with pytest.raises(ValueError, match=error):
get_array_module(0)
zeros = xp.zeros((1, 2))
Expand Down Expand Up @@ -135,14 +138,10 @@ def test_to_categorical(label_smoothing):
):
to_categorical(numpy.asarray([0, 0, 0]), label_smoothing=0.01),

with pytest.raises(
ValueError, match=r"label_smoothing parameter"
):
with pytest.raises(ValueError, match=r"label_smoothing parameter"):
to_categorical(numpy.asarray([0, 1, 2, 3, 4]), label_smoothing=0.8)

with pytest.raises(
ValueError, match=r"label_smoothing parameter"
):
with pytest.raises(ValueError, match=r"label_smoothing parameter"):
to_categorical(numpy.asarray([0, 1, 2, 3, 4]), label_smoothing=0.88)


Expand Down

0 comments on commit 5508f53

Please sign in to comment.