diff options
author | James R. Barlow <jim@purplerock.ca> | 2019-04-14 00:26:55 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2019-04-14 00:26:55 -0700 |
commit | 07154f4dec007e2e9c0c6a8c07b964fd06bc5f77 (patch) | |
tree | 61ec689af641fc045342e64bf348f024e8cc42de /tests | |
parent | 4bd7578cd1b15a45db94ca9b7f8458840fc30b3a (diff) |
Update pytest-* versions and fix some tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_metadata.py | 4 | ||||
-rw-r--r-- | tests/test_object.py | 10 | ||||
-rw-r--r-- | tests/test_pages.py | 6 |
3 files changed, 9 insertions, 11 deletions
diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 555ce5c..375b7bc 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -361,10 +361,10 @@ def test_wrong_xml(enron1): """.strip(), ) meta = enron1.open_metadata() - with pytest.raises(ValueError, message='not XMP'): + with pytest.raises(ValueError, match='not XMP'): with meta: pass - with pytest.raises(ValueError, message='not XMP'): + with pytest.raises(ValueError, match='not XMP'): meta['pdfaid:part'] diff --git a/tests/test_object.py b/tests/test_object.py index 94fb69e..1a60629 100644 --- a/tests/test_object.py +++ b/tests/test_object.py @@ -95,7 +95,7 @@ def test_decimal_from_float(f): assert isclose(py_d, d, abs_tol=1e-5), (d, f.hex()) else: - with pytest.raises(PdfError, message=repr(f)): + with pytest.raises(PdfError): Object.parse(str(d)) @@ -139,11 +139,11 @@ def test_stack_depth(): rlimit = sys.getrecursionlimit() try: sys.setrecursionlimit(100) - with pytest.raises(RecursionError, message="recursion"): + with pytest.raises(RecursionError): assert encode(a) == a - with pytest.raises(RecursionError, message="recursion"): + with pytest.raises(RecursionError): encode(a) == encode(a) # pylint: disable=expression-not-assigned - with pytest.raises(RecursionError, message="recursion"): + with pytest.raises(RecursionError): repr(a) finally: sys.setrecursionlimit(rlimit) # So other tests are not affected @@ -215,7 +215,7 @@ class TestHashViolation: def test_not_constructible(): - with pytest.raises(TypeError, message="constructor"): + with pytest.raises(TypeError, match="constructor"): Object() diff --git a/tests/test_pages.py b/tests/test_pages.py index a497b7d..3456803 100644 --- a/tests/test_pages.py +++ b/tests/test_pages.py @@ -180,16 +180,14 @@ def test_slice_differing_lengths(fourpages, sandwich): pdf = fourpages pdf2 = sandwich - with pytest.raises(ValueError, message="attempt to assign"): + with pytest.raises(ValueError, match="attempt to assign"): pdf.pages[0::2] = pdf2.pages[0:1] @pytest.mark.timeout(1) def test_self_extend(fourpages): pdf = fourpages - with pytest.raises( - ValueError, message="source page list modified during iteration" - ): + with pytest.raises(ValueError, match="source page list modified during iteration"): pdf.pages.extend(pdf.pages) |