@@ -806,9 +806,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien
806
806
respx_mock .post ("/api/v1/files/upload" ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
807
807
808
808
with pytest .raises (APITimeoutError ):
809
- client .files .with_streaming_response .upload (
810
- file = "https://www.example.com/path/to-image.jpg" , file_name = "fileName"
811
- ).__enter__ ()
809
+ client .files .with_streaming_response .upload (file = "file" , file_name = "fileName" ).__enter__ ()
812
810
813
811
assert _get_open_connections (self .client ) == 0
814
812
@@ -818,9 +816,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client
818
816
respx_mock .post ("/api/v1/files/upload" ).mock (return_value = httpx .Response (500 ))
819
817
820
818
with pytest .raises (APIStatusError ):
821
- client .files .with_streaming_response .upload (
822
- file = "https://www.example.com/path/to-image.jpg" , file_name = "fileName"
823
- ).__enter__ ()
819
+ client .files .with_streaming_response .upload (file = "file" , file_name = "fileName" ).__enter__ ()
824
820
assert _get_open_connections (self .client ) == 0
825
821
826
822
@pytest .mark .parametrize ("failures_before_success" , [0 , 2 , 4 ])
@@ -849,9 +845,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
849
845
850
846
respx_mock .post ("/api/v1/files/upload" ).mock (side_effect = retry_handler )
851
847
852
- response = client .files .with_raw_response .upload (
853
- file = "https://www.example.com/path/to-image.jpg" , file_name = "fileName"
854
- )
848
+ response = client .files .with_raw_response .upload (file = "file" , file_name = "fileName" )
855
849
856
850
assert response .retries_taken == failures_before_success
857
851
assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -876,9 +870,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
876
870
respx_mock .post ("/api/v1/files/upload" ).mock (side_effect = retry_handler )
877
871
878
872
response = client .files .with_raw_response .upload (
879
- file = "https://www.example.com/path/to-image.jpg" ,
880
- file_name = "fileName" ,
881
- extra_headers = {"x-stainless-retry-count" : Omit ()},
873
+ file = "file" , file_name = "fileName" , extra_headers = {"x-stainless-retry-count" : Omit ()}
882
874
)
883
875
884
876
assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
@@ -903,9 +895,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
903
895
respx_mock .post ("/api/v1/files/upload" ).mock (side_effect = retry_handler )
904
896
905
897
response = client .files .with_raw_response .upload (
906
- file = "https://www.example.com/path/to-image.jpg" ,
907
- file_name = "fileName" ,
908
- extra_headers = {"x-stainless-retry-count" : "42" },
898
+ file = "file" , file_name = "fileName" , extra_headers = {"x-stainless-retry-count" : "42" }
909
899
)
910
900
911
901
assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
@@ -1715,9 +1705,7 @@ async def test_retrying_timeout_errors_doesnt_leak(
1715
1705
respx_mock .post ("/api/v1/files/upload" ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
1716
1706
1717
1707
with pytest .raises (APITimeoutError ):
1718
- await async_client .files .with_streaming_response .upload (
1719
- file = "https://www.example.com/path/to-image.jpg" , file_name = "fileName"
1720
- ).__aenter__ ()
1708
+ await async_client .files .with_streaming_response .upload (file = "file" , file_name = "fileName" ).__aenter__ ()
1721
1709
1722
1710
assert _get_open_connections (self .client ) == 0
1723
1711
@@ -1729,9 +1717,7 @@ async def test_retrying_status_errors_doesnt_leak(
1729
1717
respx_mock .post ("/api/v1/files/upload" ).mock (return_value = httpx .Response (500 ))
1730
1718
1731
1719
with pytest .raises (APIStatusError ):
1732
- await async_client .files .with_streaming_response .upload (
1733
- file = "https://www.example.com/path/to-image.jpg" , file_name = "fileName"
1734
- ).__aenter__ ()
1720
+ await async_client .files .with_streaming_response .upload (file = "file" , file_name = "fileName" ).__aenter__ ()
1735
1721
assert _get_open_connections (self .client ) == 0
1736
1722
1737
1723
@pytest .mark .parametrize ("failures_before_success" , [0 , 2 , 4 ])
@@ -1761,9 +1747,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
1761
1747
1762
1748
respx_mock .post ("/api/v1/files/upload" ).mock (side_effect = retry_handler )
1763
1749
1764
- response = await client .files .with_raw_response .upload (
1765
- file = "https://www.example.com/path/to-image.jpg" , file_name = "fileName"
1766
- )
1750
+ response = await client .files .with_raw_response .upload (file = "file" , file_name = "fileName" )
1767
1751
1768
1752
assert response .retries_taken == failures_before_success
1769
1753
assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -1789,9 +1773,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
1789
1773
respx_mock .post ("/api/v1/files/upload" ).mock (side_effect = retry_handler )
1790
1774
1791
1775
response = await client .files .with_raw_response .upload (
1792
- file = "https://www.example.com/path/to-image.jpg" ,
1793
- file_name = "fileName" ,
1794
- extra_headers = {"x-stainless-retry-count" : Omit ()},
1776
+ file = "file" , file_name = "fileName" , extra_headers = {"x-stainless-retry-count" : Omit ()}
1795
1777
)
1796
1778
1797
1779
assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
@@ -1817,9 +1799,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
1817
1799
respx_mock .post ("/api/v1/files/upload" ).mock (side_effect = retry_handler )
1818
1800
1819
1801
response = await client .files .with_raw_response .upload (
1820
- file = "https://www.example.com/path/to-image.jpg" ,
1821
- file_name = "fileName" ,
1822
- extra_headers = {"x-stainless-retry-count" : "42" },
1802
+ file = "file" , file_name = "fileName" , extra_headers = {"x-stainless-retry-count" : "42" }
1823
1803
)
1824
1804
1825
1805
assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
0 commit comments