Skip to content

Commit 73d94af

Browse files
Add match= expressions to live tests
Assisted-by: Codex
1 parent 57868d2 commit 73d94af

22 files changed

Lines changed: 50 additions & 50 deletions

tests/live/test_live_compress_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def test_live_compress_pdf_invalid_level(
158158
api_key=pdfrest_api_key,
159159
base_url=pdfrest_live_base_url,
160160
) as client,
161-
pytest.raises(PdfRestApiError),
161+
pytest.raises(PdfRestApiError, match=r"(?i)compression"),
162162
):
163163
client.compress_pdf(
164164
uploaded_pdf_for_compression,
@@ -177,7 +177,7 @@ async def test_live_async_compress_pdf_invalid_level(
177177
api_key=pdfrest_api_key,
178178
base_url=pdfrest_live_base_url,
179179
) as client:
180-
with pytest.raises(PdfRestApiError):
180+
with pytest.raises(PdfRestApiError, match=r"(?i)compression"):
181181
await client.compress_pdf(
182182
uploaded_pdf_for_compression,
183183
compression_level="low",

tests/live/test_live_convert_to_excel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_live_convert_to_excel_invalid_file_id(
9393
api_key=pdfrest_api_key,
9494
base_url=pdfrest_live_base_url,
9595
) as client,
96-
pytest.raises(PdfRestApiError),
96+
pytest.raises(PdfRestApiError, match=r"(?i)(id|file)"),
9797
):
9898
client.convert_to_excel(
9999
uploaded_pdf_for_excel,
@@ -111,7 +111,7 @@ async def test_live_async_convert_to_excel_invalid_file_id(
111111
api_key=pdfrest_api_key,
112112
base_url=pdfrest_live_base_url,
113113
) as client:
114-
with pytest.raises(PdfRestApiError):
114+
with pytest.raises(PdfRestApiError, match=r"(?i)(id|file)"):
115115
await client.convert_to_excel(
116116
uploaded_pdf_for_excel,
117117
extra_body={"id": "ffffffff-ffff-ffff-ffff-ffffffffffff"},

tests/live/test_live_convert_to_markdown.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_live_convert_to_markdown_invalid_pages(
6363
base_url=pdfrest_live_base_url,
6464
) as client:
6565
uploaded = client.files.create_from_paths([resource])[0]
66-
with pytest.raises(PdfRestApiError):
66+
with pytest.raises(PdfRestApiError, match=r"(?i)page"):
6767
client.convert_to_markdown(
6868
uploaded,
6969
extra_body={"pages": "last-1"},
@@ -81,7 +81,7 @@ async def test_live_async_convert_to_markdown_invalid_pages(
8181
base_url=pdfrest_live_base_url,
8282
) as client:
8383
uploaded = (await client.files.create_from_paths([resource]))[0]
84-
with pytest.raises(PdfRestApiError):
84+
with pytest.raises(PdfRestApiError, match=r"(?i)page"):
8585
await client.convert_to_markdown(
8686
uploaded,
8787
extra_body={"pages": "last-1"},

tests/live/test_live_convert_to_pdfx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_live_convert_to_pdfx_invalid_output_type(
9494
api_key=pdfrest_api_key,
9595
base_url=pdfrest_live_base_url,
9696
) as client,
97-
pytest.raises(PdfRestApiError),
97+
pytest.raises(PdfRestApiError, match=r"(?i)pdf.?x"),
9898
):
9999
client.convert_to_pdfx(
100100
uploaded_pdf_for_pdfx,
@@ -113,7 +113,7 @@ async def test_live_async_convert_to_pdfx_invalid_output_type(
113113
api_key=pdfrest_api_key,
114114
base_url=pdfrest_live_base_url,
115115
) as client:
116-
with pytest.raises(PdfRestApiError):
116+
with pytest.raises(PdfRestApiError, match=r"(?i)pdf.?x"):
117117
await client.convert_to_pdfx(
118118
uploaded_pdf_for_pdfx,
119119
output_type="PDF/X-1a",

tests/live/test_live_convert_to_powerpoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_live_convert_to_powerpoint_invalid_file_id(
9595
api_key=pdfrest_api_key,
9696
base_url=pdfrest_live_base_url,
9797
) as client,
98-
pytest.raises(PdfRestApiError),
98+
pytest.raises(PdfRestApiError, match=r"(?i)(id|file)"),
9999
):
100100
client.convert_to_powerpoint(
101101
uploaded_pdf_for_powerpoint,
@@ -113,7 +113,7 @@ async def test_live_async_convert_to_powerpoint_invalid_file_id(
113113
api_key=pdfrest_api_key,
114114
base_url=pdfrest_live_base_url,
115115
) as client:
116-
with pytest.raises(PdfRestApiError):
116+
with pytest.raises(PdfRestApiError, match=r"(?i)(id|file)"):
117117
await client.convert_to_powerpoint(
118118
uploaded_pdf_for_powerpoint,
119119
extra_body={"id": "ffffffff-ffff-ffff-ffff-ffffffffffff"},

tests/live/test_live_convert_to_word.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_live_convert_to_word_invalid_file_id(
9292
api_key=pdfrest_api_key,
9393
base_url=pdfrest_live_base_url,
9494
) as client,
95-
pytest.raises(PdfRestApiError),
95+
pytest.raises(PdfRestApiError, match=r"(?i)(id|file)"),
9696
):
9797
client.convert_to_word(
9898
uploaded_pdf_for_word,
@@ -110,7 +110,7 @@ async def test_live_async_convert_to_word_invalid_file_id(
110110
api_key=pdfrest_api_key,
111111
base_url=pdfrest_live_base_url,
112112
) as client:
113-
with pytest.raises(PdfRestApiError):
113+
with pytest.raises(PdfRestApiError, match=r"(?i)(id|file)"):
114114
await client.convert_to_word(
115115
uploaded_pdf_for_word,
116116
extra_body={"id": "ffffffff-ffff-ffff-ffff-ffffffffffff"},

tests/live/test_live_convert_xfa_to_acroforms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_live_convert_xfa_to_acroforms_invalid_file_id(
6666
api_key=pdfrest_api_key,
6767
base_url=pdfrest_live_base_url,
6868
) as client,
69-
pytest.raises(PdfRestApiError),
69+
pytest.raises(PdfRestApiError, match=r"(?i)(id|file)"),
7070
):
7171
client.convert_xfa_to_acroforms(
7272
uploaded_pdf_for_acroforms,
@@ -107,7 +107,7 @@ async def test_live_async_convert_xfa_to_acroforms_invalid_file_id(
107107
api_key=pdfrest_api_key,
108108
base_url=pdfrest_live_base_url,
109109
) as client:
110-
with pytest.raises(PdfRestApiError):
110+
with pytest.raises(PdfRestApiError, match=r"(?i)(id|file)"):
111111
await client.convert_xfa_to_acroforms(
112112
uploaded_pdf_for_acroforms,
113113
extra_body={"id": "ffffffff-ffff-ffff-ffff-ffffffffffff"},

tests/live/test_live_delete.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_live_delete_files_invalid_id(
5757
base_url=pdfrest_live_base_url,
5858
) as client:
5959
uploaded = client.files.create_from_paths([resource])[0]
60-
with pytest.raises(ValidationError):
60+
with pytest.raises(ValidationError, match=r"(?i)ids?"):
6161
client.files.delete(uploaded, extra_body={"ids": token_urlsafe(16)})
6262

6363

@@ -72,7 +72,7 @@ async def test_live_async_delete_files_invalid_id(
7272
base_url=pdfrest_live_base_url,
7373
) as client:
7474
uploaded = (await client.files.create_from_paths([resource]))[0]
75-
with pytest.raises(ValidationError):
75+
with pytest.raises(ValidationError, match=r"(?i)ids?"):
7676
await client.files.delete(uploaded, extra_body={"ids": token_urlsafe(16)})
7777

7878

tests/live/test_live_extract_images.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_live_extract_images_invalid_pages(
7070
base_url=pdfrest_live_base_url,
7171
) as client:
7272
uploaded = client.files.create_from_paths([resource])[0]
73-
with pytest.raises(PdfRestApiError):
73+
with pytest.raises(PdfRestApiError, match=r"(?i)page"):
7474
client.extract_images(
7575
uploaded,
7676
extra_body={"pages": "last-1"},
@@ -88,7 +88,7 @@ async def test_live_async_extract_images_invalid_pages(
8888
base_url=pdfrest_live_base_url,
8989
) as client:
9090
uploaded = (await client.files.create_from_paths([resource]))[0]
91-
with pytest.raises(PdfRestApiError):
91+
with pytest.raises(PdfRestApiError, match=r"(?i)page"):
9292
await client.extract_images(
9393
uploaded,
9494
extra_body={"pages": "last-1"},

tests/live/test_live_extract_pdf_text_to_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_live_extract_pdf_text_to_file_invalid_pages(
7676
base_url=pdfrest_live_base_url,
7777
) as client:
7878
uploaded = client.files.create_from_paths([resource])[0]
79-
with pytest.raises(PdfRestApiError):
79+
with pytest.raises(PdfRestApiError, match=r"(?i)page"):
8080
client.extract_pdf_text_to_file(
8181
uploaded,
8282
extra_body={"pages": "last-1"},
@@ -94,7 +94,7 @@ async def test_live_async_extract_pdf_text_to_file_invalid_pages(
9494
base_url=pdfrest_live_base_url,
9595
) as client:
9696
uploaded = (await client.files.create_from_paths([resource]))[0]
97-
with pytest.raises(PdfRestApiError):
97+
with pytest.raises(PdfRestApiError, match=r"(?i)page"):
9898
await client.extract_pdf_text_to_file(
9999
uploaded,
100100
extra_body={"pages": "last-1"},

0 commit comments

Comments
 (0)