2020-05-14 12:14:15 +00:00
|
|
|
from inspect import isclass
|
|
|
|
|
2020-05-14 13:45:58 +00:00
|
|
|
import pytest
|
|
|
|
|
2021-11-03 14:29:32 +00:00
|
|
|
from spacy.errors import ErrorsWithCodes
|
2020-05-14 12:14:15 +00:00
|
|
|
|
|
|
|
|
2021-11-03 14:29:32 +00:00
|
|
|
class Errors(metaclass=ErrorsWithCodes):
|
2020-05-14 12:14:15 +00:00
|
|
|
E001 = "error description"
|
|
|
|
|
|
|
|
|
|
|
|
def test_add_codes():
|
|
|
|
assert Errors.E001 == "[E001] error description"
|
2020-05-14 13:45:58 +00:00
|
|
|
with pytest.raises(AttributeError):
|
|
|
|
Errors.E002
|
2020-05-14 12:14:15 +00:00
|
|
|
assert isclass(Errors.__class__)
|