Unverified Commit 657f03ad authored by Kai Chen's avatar Kai Chen Committed by GitHub
Browse files

replace DeprecationWarning with UserWarning (#353)

parent 79942100
......@@ -63,8 +63,7 @@ class Registry:
warnings.warn(
'The old API of register_module(module, force=False) '
'is deprecated and will be removed, please use the new API '
'register_module(name=None, force=False, module=None) instead.',
DeprecationWarning)
'register_module(name=None, force=False, module=None) instead.')
if cls is None:
return partial(self.deprecated_register_module, force=force)
self._register_module(cls, force=force)
......
......@@ -82,15 +82,15 @@ def test_registry():
pass
# begin: test old APIs
with pytest.warns(DeprecationWarning):
with pytest.warns(UserWarning):
CATS.register_module(SphynxCat)
assert CATS.get('SphynxCat').__name__ == 'SphynxCat'
with pytest.warns(DeprecationWarning):
with pytest.warns(UserWarning):
CATS.register_module(SphynxCat, force=True)
assert CATS.get('SphynxCat').__name__ == 'SphynxCat'
with pytest.warns(DeprecationWarning):
with pytest.warns(UserWarning):
@CATS.register_module
class NewCat:
......@@ -98,11 +98,11 @@ def test_registry():
assert CATS.get('NewCat').__name__ == 'NewCat'
with pytest.warns(DeprecationWarning):
with pytest.warns(UserWarning):
CATS.deprecated_register_module(SphynxCat, force=True)
assert CATS.get('SphynxCat').__name__ == 'SphynxCat'
with pytest.warns(DeprecationWarning):
with pytest.warns(UserWarning):
@CATS.deprecated_register_module
class CuteCat:
......@@ -110,7 +110,7 @@ def test_registry():
assert CATS.get('CuteCat').__name__ == 'CuteCat'
with pytest.warns(DeprecationWarning):
with pytest.warns(UserWarning):
@CATS.deprecated_register_module(force=True)
class NewCat2:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment