Fix pytest deprecation warnings

This commit is contained in:
James Barlow
2022-04-03 13:30:58 -07:00
parent f29fe7f23e
commit 0c43963d69
+3 -5
View File
@@ -173,17 +173,15 @@ def test_stack_abuse():
p = pikepdf.Pdf.new()
stream = pikepdf.Stream(p, b'q ' * 35)
with pytest.warns(None) as record:
with pytest.warns(UserWarning, match="overflowed"):
pdfinfo.info._interpret_contents(stream)
assert 'overflowed' in str(record[0].message)
stream = pikepdf.Stream(p, b'q Q Q Q Q')
with pytest.warns(None) as record:
with pytest.warns(UserWarning, match="underflowed") as record:
pdfinfo.info._interpret_contents(stream)
assert 'underflowed' in str(record[0].message)
stream = pikepdf.Stream(p, b'q ' * 135)
with pytest.warns(None):
with pytest.warns():
with pytest.raises(RuntimeError):
pdfinfo.info._interpret_contents(stream)