@@ -724,20 +724,24 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str
724724 @mock .patch ("supermemory._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
725725 @pytest .mark .respx (base_url = base_url )
726726 def test_retrying_timeout_errors_doesnt_leak (self , respx_mock : MockRouter , client : Supermemory ) -> None :
727- respx_mock .patch ("/v3/documents/id " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
727+ respx_mock .post ("/v3/documents" ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
728728
729729 with pytest .raises (APITimeoutError ):
730- client .memories .with_streaming_response .update (id = "id" ).__enter__ ()
730+ client .memories .with_streaming_response .add (
731+ content = "This is a detailed article about machine learning concepts..."
732+ ).__enter__ ()
731733
732734 assert _get_open_connections (self .client ) == 0
733735
734736 @mock .patch ("supermemory._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
735737 @pytest .mark .respx (base_url = base_url )
736738 def test_retrying_status_errors_doesnt_leak (self , respx_mock : MockRouter , client : Supermemory ) -> None :
737- respx_mock .patch ("/v3/documents/id " ).mock (return_value = httpx .Response (500 ))
739+ respx_mock .post ("/v3/documents" ).mock (return_value = httpx .Response (500 ))
738740
739741 with pytest .raises (APIStatusError ):
740- client .memories .with_streaming_response .update (id = "id" ).__enter__ ()
742+ client .memories .with_streaming_response .add (
743+ content = "This is a detailed article about machine learning concepts..."
744+ ).__enter__ ()
741745 assert _get_open_connections (self .client ) == 0
742746
743747 @pytest .mark .parametrize ("failures_before_success" , [0 , 2 , 4 ])
@@ -764,9 +768,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
764768 return httpx .Response (500 )
765769 return httpx .Response (200 )
766770
767- respx_mock .patch ("/v3/documents/id " ).mock (side_effect = retry_handler )
771+ respx_mock .post ("/v3/documents" ).mock (side_effect = retry_handler )
768772
769- response = client .memories .with_raw_response .update (id = "id" )
773+ response = client .memories .with_raw_response .add (
774+ content = "This is a detailed article about machine learning concepts..."
775+ )
770776
771777 assert response .retries_taken == failures_before_success
772778 assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -788,9 +794,12 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
788794 return httpx .Response (500 )
789795 return httpx .Response (200 )
790796
791- respx_mock .patch ("/v3/documents/id " ).mock (side_effect = retry_handler )
797+ respx_mock .post ("/v3/documents" ).mock (side_effect = retry_handler )
792798
793- response = client .memories .with_raw_response .update (id = "id" , extra_headers = {"x-stainless-retry-count" : Omit ()})
799+ response = client .memories .with_raw_response .add (
800+ content = "This is a detailed article about machine learning concepts..." ,
801+ extra_headers = {"x-stainless-retry-count" : Omit ()},
802+ )
794803
795804 assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
796805
@@ -811,9 +820,12 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
811820 return httpx .Response (500 )
812821 return httpx .Response (200 )
813822
814- respx_mock .patch ("/v3/documents/id " ).mock (side_effect = retry_handler )
823+ respx_mock .post ("/v3/documents" ).mock (side_effect = retry_handler )
815824
816- response = client .memories .with_raw_response .update (id = "id" , extra_headers = {"x-stainless-retry-count" : "42" })
825+ response = client .memories .with_raw_response .add (
826+ content = "This is a detailed article about machine learning concepts..." ,
827+ extra_headers = {"x-stainless-retry-count" : "42" },
828+ )
817829
818830 assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
819831
@@ -1541,10 +1553,12 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte
15411553 async def test_retrying_timeout_errors_doesnt_leak (
15421554 self , respx_mock : MockRouter , async_client : AsyncSupermemory
15431555 ) -> None :
1544- respx_mock .patch ("/v3/documents/id " ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
1556+ respx_mock .post ("/v3/documents" ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
15451557
15461558 with pytest .raises (APITimeoutError ):
1547- await async_client .memories .with_streaming_response .update (id = "id" ).__aenter__ ()
1559+ await async_client .memories .with_streaming_response .add (
1560+ content = "This is a detailed article about machine learning concepts..."
1561+ ).__aenter__ ()
15481562
15491563 assert _get_open_connections (self .client ) == 0
15501564
@@ -1553,10 +1567,12 @@ async def test_retrying_timeout_errors_doesnt_leak(
15531567 async def test_retrying_status_errors_doesnt_leak (
15541568 self , respx_mock : MockRouter , async_client : AsyncSupermemory
15551569 ) -> None :
1556- respx_mock .patch ("/v3/documents/id " ).mock (return_value = httpx .Response (500 ))
1570+ respx_mock .post ("/v3/documents" ).mock (return_value = httpx .Response (500 ))
15571571
15581572 with pytest .raises (APIStatusError ):
1559- await async_client .memories .with_streaming_response .update (id = "id" ).__aenter__ ()
1573+ await async_client .memories .with_streaming_response .add (
1574+ content = "This is a detailed article about machine learning concepts..."
1575+ ).__aenter__ ()
15601576 assert _get_open_connections (self .client ) == 0
15611577
15621578 @pytest .mark .parametrize ("failures_before_success" , [0 , 2 , 4 ])
@@ -1584,9 +1600,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
15841600 return httpx .Response (500 )
15851601 return httpx .Response (200 )
15861602
1587- respx_mock .patch ("/v3/documents/id " ).mock (side_effect = retry_handler )
1603+ respx_mock .post ("/v3/documents" ).mock (side_effect = retry_handler )
15881604
1589- response = await client .memories .with_raw_response .update (id = "id" )
1605+ response = await client .memories .with_raw_response .add (
1606+ content = "This is a detailed article about machine learning concepts..."
1607+ )
15901608
15911609 assert response .retries_taken == failures_before_success
15921610 assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -1609,10 +1627,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
16091627 return httpx .Response (500 )
16101628 return httpx .Response (200 )
16111629
1612- respx_mock .patch ("/v3/documents/id " ).mock (side_effect = retry_handler )
1630+ respx_mock .post ("/v3/documents" ).mock (side_effect = retry_handler )
16131631
1614- response = await client .memories .with_raw_response .update (
1615- id = "id" , extra_headers = {"x-stainless-retry-count" : Omit ()}
1632+ response = await client .memories .with_raw_response .add (
1633+ content = "This is a detailed article about machine learning concepts..." ,
1634+ extra_headers = {"x-stainless-retry-count" : Omit ()},
16161635 )
16171636
16181637 assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
@@ -1635,10 +1654,11 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
16351654 return httpx .Response (500 )
16361655 return httpx .Response (200 )
16371656
1638- respx_mock .patch ("/v3/documents/id " ).mock (side_effect = retry_handler )
1657+ respx_mock .post ("/v3/documents" ).mock (side_effect = retry_handler )
16391658
1640- response = await client .memories .with_raw_response .update (
1641- id = "id" , extra_headers = {"x-stainless-retry-count" : "42" }
1659+ response = await client .memories .with_raw_response .add (
1660+ content = "This is a detailed article about machine learning concepts..." ,
1661+ extra_headers = {"x-stainless-retry-count" : "42" },
16421662 )
16431663
16441664 assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
0 commit comments