Add tests for prefer_gpu() and require_gpu()

This commit is contained in:
Matthew Honnibal 2018-10-14 23:05:22 +02:00
parent 62c70b3163
commit 91593b7378
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,7 @@ from .. import displacy
from ..tokens import Span
from .util import get_doc
from .._ml import PrecomputableAffine
from .. import prefer_gpu, require_gpu
from pathlib import Path
import pytest
@ -101,3 +102,10 @@ def test_PrecomputableAffine(nO=4, nI=5, nF=3, nP=2):
assert model.d_pad[0, 2, 0, 0] == 0.
model._backprop_padding(dY, ids)
assert model.d_pad[0, 2, 0, 0] == 3.
def test_prefer_gpu():
assert not prefer_gpu()
def test_require_gpu():
with pytest.raises(ValueError):
require_gpu()