Skip to content

Commit

Permalink
update : tests updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
sadrasabouri committed Jul 30, 2024
1 parent b7748da commit ff23e3d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/nft_upload_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
>>> counter = 0
>>> try_limit = 10
>>> status = False
>>> result = {}
>>> while(status == False and counter<try_limit):
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY, depth=3)
... with warns(DeprecationWarning, match='`test_deprecated` is deprecated and may be removed in future releases.')
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY, depth=3)
... counter = counter + 1
... status = result["status"]
... time.sleep(10)
Expand All @@ -23,7 +25,8 @@
>>> status = False
>>> counter = 0
>>> while(status == False and counter<try_limit):
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY, upload_config=True)
... with warns(DeprecationWarning, match='`test_deprecated` is deprecated and may be removed in future releases.')
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY, upload_config=True)
... counter = counter + 1
... status = all(result["status"].values())
... time.sleep(10)
Expand All @@ -34,7 +37,8 @@
>>> status = False
>>> counter = 0
>>> while(status == False and counter<try_limit):
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY, upload_data=True)
... with warns(DeprecationWarning, match='`test_deprecated` is deprecated and may be removed in future releases.')
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY, upload_data=True)
... counter = counter + 1
... status = all(result["status"].values())
... time.sleep(10)
Expand All @@ -45,7 +49,8 @@
>>> status = False
>>> counter = 0
>>> while(status == False and counter<try_limit):
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY, upload_data=True, upload_config=True, gateway=Gateway.CID)
... with warns(DeprecationWarning, match='`test_deprecated` is deprecated and may be removed in future releases.')
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY, upload_data=True, upload_config=True, gateway=Gateway.CID)
... counter = counter + 1
... status = all(result["status"].values())
... time.sleep(10)
Expand Down
6 changes: 6 additions & 0 deletions test/warning_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
>>> import os
>>> import json
>>> from samila import *
>>> from samila.functions import deprecated
>>> from pytest import warns
>>> g = GenerativeImage(lambda x,y: 0, lambda x,y: 0)
>>> g.generate(step=0.1)
Expand Down Expand Up @@ -45,6 +46,11 @@
... g.plot(color='complement', bgcolor='complement')
>>> with warns(RuntimeWarning, match=r"color 'rad' not found. Replacing it with 'red'"):
... g.plot(color='rad')
>>> @deprecated
... def test_deprecated():
... return
>>> with warns(DeprecationWarning, match='`test_deprecated` is deprecated and may be removed in future releases.'):
... test_deprecated()
>>> os.remove('data.json')
>>> os.remove('config.json')
"""

0 comments on commit ff23e3d

Please sign in to comment.