Skip to content

Commit f348cf7

Browse files
committed
address comments
1 parent 258c2f1 commit f348cf7

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

_test_unstructured_client/test_utils_retries.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
import logging
3+
import re
34

45
import requests_mock
56

@@ -27,10 +28,7 @@ def test_retry_with_backoff_does_retry(caplog):
2728
session = UnstructuredClient(api_key_auth=FAKE_KEY)
2829

2930
with open(filename, "rb") as f:
30-
files=shared.Files(
31-
content=f.read(),
32-
file_name=filename,
33-
)
31+
files=shared.Files(content=f.read(), file_name=filename)
3432

3533
req = shared.PartitionParameters(files=files)
3634

@@ -59,14 +57,10 @@ def test_backoff_strategy_logs_retries(caplog):
5957
session = UnstructuredClient(api_key_auth=FAKE_KEY)
6058

6159
with open(filename, "rb") as f:
62-
files=shared.Files(
63-
content=f.read(),
64-
file_name=filename,
65-
)
60+
files=shared.Files(content=f.read(), file_name=filename)
6661

6762
req = shared.PartitionParameters(files=files)
6863
with pytest.raises(Exception):
6964
session.general.partition(req, retries=retries)
70-
71-
72-
assert "seconds before retry" in caplog.text
65+
pattern = re.compile(f"{re.escape('Retry attempt #1. Sleeping')}.*{'seconds before retry'}")
66+
assert bool(pattern.search(caplog.text))

0 commit comments

Comments
 (0)