Skip to content

Commit

Permalink
Fix package name
Browse files Browse the repository at this point in the history
  • Loading branch information
cachitas committed Mar 31, 2024
1 parent fa9b734 commit 97a746e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ dev = ["pytest>=8.1.1", "pytest-httpx>=0.30.0"]

[tool.pdm.version]
source = "file"
path = "src/stringdb/__init__.py"
path = "src/stringx/__init__.py"
2 changes: 1 addition & 1 deletion src/stringdb/__init__.py → src/stringx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
STRING API client using httpx.
"""

__version__ = "0.2.0"
__version__ = "0.2.1"

from typing import List

Expand Down
2 changes: 1 addition & 1 deletion src/stringdb/client.py → src/stringx/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Client(httpx.Client):
def __init__(
self, base_url: str = "https://string-db.org", *, identity: Optional[str] = None
) -> None:
from stringdb import DEFAULT_CALLER_IDENTITY
from stringx import DEFAULT_CALLER_IDENTITY

super().__init__(
params=dict(caller_identity=identity or DEFAULT_CALLER_IDENTITY),
Expand Down
22 changes: 11 additions & 11 deletions tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import httpx

import stringdb
import stringx


def test_default_base_url():
with stringdb.Client() as client:
with stringx.Client() as client:
assert client.base_url.scheme == "https"
assert client.base_url.host == "string-db.org"
assert client.base_url.path == "/"


def test_custom_address():
with stringdb.Client("https://example.com/api/v2") as client:
with stringx.Client("https://example.com/api/v2") as client:
assert client.base_url.host == "example.com"
assert client.base_url.path == "/api/v2/"


def test_timeout():
with stringdb.Client() as client:
with stringx.Client() as client:
assert client.timeout.connect == 5.0
assert client.timeout.pool == 5.0
assert client.timeout.read == 5.0
assert client.timeout.write == 5.0


def test_caller_identity():
with stringdb.Client() as client:
assert client.params["caller_identity"] == stringdb.DEFAULT_CALLER_IDENTITY
with stringx.Client() as client:
assert client.params["caller_identity"] == stringx.DEFAULT_CALLER_IDENTITY


def test_custom_caller_identity():
custom_identity = "random tool"
with stringdb.Client(identity=custom_identity) as client:
with stringx.Client(identity=custom_identity) as client:
assert client.params["caller_identity"] == custom_identity


Expand All @@ -44,14 +44,14 @@ def test_map_identifiers(httpx_mock):
"species": "7227",
"limit": 1,
"echo_query": True,
"caller_identity": stringdb.DEFAULT_CALLER_IDENTITY,
"caller_identity": stringx.DEFAULT_CALLER_IDENTITY,
},
),
method="POST",
json=True,
)

with stringdb.Client() as client:
with stringx.Client() as client:
client.map_identifiers(["some_identifier"], 7227)


Expand All @@ -62,12 +62,12 @@ def test_interaction_partners(httpx_mock):
params={
"identifiers": "id1\rid2",
"species": "7227",
"caller_identity": stringdb.DEFAULT_CALLER_IDENTITY,
"caller_identity": stringx.DEFAULT_CALLER_IDENTITY,
},
),
method="POST",
json=True,
)

with stringdb.Client() as client:
with stringx.Client() as client:
client.interaction_partners(["id1", "id2"], 7227)
6 changes: 3 additions & 3 deletions tests/test_stringdb.py → tests/test_stringx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import stringdb
import stringx


def test_map_identifiers():
identifiers = stringdb.map_identifiers(["edin"], 7227)
identifiers = stringx.map_identifiers(["edin"], 7227)

assert len(identifiers) == 1

Expand All @@ -19,7 +19,7 @@ def test_map_identifiers():


def test_interaction_partners():
interaction_partners = stringdb.interaction_partners(["edin"], 7227)
interaction_partners = stringx.interaction_partners(["edin"], 7227)

assert len(interaction_partners) > 1

Expand Down

0 comments on commit 97a746e

Please sign in to comment.