Use logger.warning instead of logger.warn (#6596)

Use `logger.warning` instead of deprecated `logger.warn`.
This commit is contained in:
Adriane Boyd 2020-12-21 01:25:10 +01:00 committed by GitHub
parent 282a3b49ea
commit cabd4ae5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -198,7 +198,7 @@ class Lemmatizer(Pipe):
univ_pos = token.pos_.lower() univ_pos = token.pos_.lower()
if univ_pos in ("", "eol", "space"): if univ_pos in ("", "eol", "space"):
if univ_pos == "": if univ_pos == "":
logger.warn(Warnings.W108.format(text=string)) logger.warning(Warnings.W108.format(text=string))
return [string.lower()] return [string.lower()]
# See Issue #435 for example of where this logic is requied. # See Issue #435 for example of where this logic is requied.
if self.is_base_form(token): if self.is_base_form(token):

View File

@ -59,9 +59,9 @@ def test_lemmatizer_config(nlp):
# warning if no POS assigned # warning if no POS assigned
doc = nlp.make_doc("coping") doc = nlp.make_doc("coping")
logger = logging.getLogger("spacy") logger = logging.getLogger("spacy")
with mock.patch.object(logger, "warn") as mock_warn: with mock.patch.object(logger, "warning") as mock_warning:
doc = lemmatizer(doc) doc = lemmatizer(doc)
mock_warn.assert_called_once() mock_warning.assert_called_once()
# works with POS # works with POS
doc = nlp.make_doc("coping") doc = nlp.make_doc("coping")