Parametrized test

This commit is contained in:
Andrew Murray 2020-03-31 17:25:26 +11:00
parent 7597a9fbfd
commit 750bbc7256

View File

@ -609,30 +609,33 @@ class TestImage:
assert not fp.closed assert not fp.closed
def test_pillow_version(self): @pytest.mark.parametrize(
"test_module", [PIL, Image],
)
def test_pillow_version(self, test_module):
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
assert PIL.PILLOW_VERSION == PIL.__version__ assert test_module.PILLOW_VERSION == PIL.__version__
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
str(PIL.PILLOW_VERSION) str(test_module.PILLOW_VERSION)
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
assert int(PIL.PILLOW_VERSION[0]) >= 7 assert int(test_module.PILLOW_VERSION[0]) >= 7
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
assert PIL.PILLOW_VERSION < "9.9.0" assert test_module.PILLOW_VERSION < "9.9.0"
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
assert PIL.PILLOW_VERSION <= "9.9.0" assert test_module.PILLOW_VERSION <= "9.9.0"
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
assert PIL.PILLOW_VERSION != "7.0.0" assert test_module.PILLOW_VERSION != "7.0.0"
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
assert PIL.PILLOW_VERSION >= "7.0.0" assert test_module.PILLOW_VERSION >= "7.0.0"
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
assert PIL.PILLOW_VERSION > "7.0.0" assert test_module.PILLOW_VERSION > "7.0.0"
def test_overrun(self): def test_overrun(self):
for file in [ for file in [