Skip to content

Commit

Permalink
Lock dependencies by major version only (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshalX authored Dec 11, 2023
1 parent f19e8d1 commit 9ffc6d1
Show file tree
Hide file tree
Showing 12 changed files with 282 additions and 258 deletions.
439 changes: 220 additions & 219 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ atproto = "atproto.cli:atproto_cli"
[tool.poetry.dependencies]
python = ">=3.7.1,<3.13"
httpx = ">=0.24.0,<0.26.0"
dacite = ">=1.8.0,<1.9.0"
typing-extensions = ">=4.6.1,<4.8.0"
pyjwt = ">=2.7.0,<2.9.0"
click = ">=8.1.3,<8.2.0"
websockets = ">=11.0.3,<11.1.0"
dacite = ">=1.8.0,<2"
typing-extensions = ">=4.6.1,<5"
pyjwt = ">=2.7.0,<3"
click = ">=8.1.3,<9"
websockets = ">=11.0.3,<13"
pydantic = ">=2.0,<3.0"
libipld = ">=1.0.0,<2.0.0"

Expand Down
8 changes: 5 additions & 3 deletions tests/models/tests/test_custom_like_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from atproto.xrpc_client.models.dot_dict import DotDict
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('custom_like_record')

def load_test_data() -> dict:
return load_data_from_file('custom_like_record')


def test_custom_like_record_deserialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

assert isinstance(model, models.ComAtprotoRepoGetRecord.Response)
assert isinstance(model.value, DotDict)
Expand All @@ -19,7 +21,7 @@ def test_custom_like_record_deserialization():


def test_custom_like_record_serialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

model_dict = get_model_as_dict(model)
restored_model = get_or_create(model_dict, models.ComAtprotoRepoGetRecord.Response)
Expand Down
8 changes: 5 additions & 3 deletions tests/models/tests/test_custom_post_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from atproto.xrpc_client.models.dot_dict import DotDict
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('custom_post_record')

def load_test_data() -> dict:
return load_data_from_file('custom_post_record')


def test_custom_post_record_deserialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

assert isinstance(model, models.ComAtprotoRepoGetRecord.Response)
assert isinstance(model.value, DotDict)
Expand All @@ -19,7 +21,7 @@ def test_custom_post_record_deserialization():


def test_custom_post_record_serialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

model_dict = get_model_as_dict(model)
restored_model = get_or_create(model_dict, models.ComAtprotoRepoGetRecord.Response)
Expand Down
6 changes: 4 additions & 2 deletions tests/models/tests/test_did_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from atproto.xrpc_client.models.dot_dict import DotDict
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('did_doc')

def load_test_data() -> dict:
return load_data_from_file('did_doc')


def test_did_doc_deserialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoDescribeRepo.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoDescribeRepo.Response)

assert isinstance(model, models.ComAtprotoRepoDescribeRepo.Response)

Expand Down
16 changes: 9 additions & 7 deletions tests/models/tests/test_feed_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
from atproto.xrpc_client.models.blob_ref import BlobRef
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('feed_record')

def load_test_data() -> dict:
return load_data_from_file('feed_record')


def test_feed_record_deserialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

assert isinstance(model, models.ComAtprotoRepoGetRecord.Response)
assert isinstance(model.value, models.AppBskyFeedGenerator.Main)
Expand All @@ -22,7 +24,7 @@ def test_feed_record_deserialization():


def test_feed_record_serialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

model_dict = get_model_as_dict(model)
restored_model = get_or_create(model_dict, models.ComAtprotoRepoGetRecord.Response)
Expand All @@ -43,7 +45,7 @@ def test_feed_record_serialization():


def test_feed_record_avatar_deserialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

assert isinstance(model, models.ComAtprotoRepoGetRecord.Response)
assert isinstance(model.value.avatar, BlobRef)
Expand All @@ -53,7 +55,7 @@ def test_feed_record_avatar_deserialization():


def test_feed_record_avatar_serialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

avatar = model.value.avatar
avatar_dict = get_model_as_dict(avatar)
Expand All @@ -69,14 +71,14 @@ def test_feed_record_avatar_serialization():


def test_feed_record_py_type_frozen():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

with pytest.raises(ValidationError):
model.value.py_type = 'app.bsky.feed.generator'


def test_feed_record_model_strict_mode():
test_data = load_data_from_file('feed_record')
test_data = load_test_data()

non_str_did = 123
test_data['value']['did'] = non_str_did
Expand Down
8 changes: 5 additions & 3 deletions tests/models/tests/test_get_follows.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from atproto.xrpc_client.models import get_model_as_dict, get_or_create
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('get_follows')

def load_test_data() -> dict:
return load_data_from_file('get_follows')


def _find_muted_follow(
Expand All @@ -23,7 +25,7 @@ def test_get_follows_deserialization():
Note:
The response must contain at least one mutedByList follow.
"""
model = get_or_create(TEST_DATA, models.AppBskyGraphGetFollows.Response)
model = get_or_create(load_test_data(), models.AppBskyGraphGetFollows.Response)

assert isinstance(model, models.AppBskyGraphGetFollows.Response)

Expand All @@ -42,7 +44,7 @@ def test_get_follows_serialization():
Note:
The response must contain at least one mutedByList follow.
"""
model = get_or_create(TEST_DATA, models.AppBskyGraphGetFollows.Response)
model = get_or_create(load_test_data(), models.AppBskyGraphGetFollows.Response)

model_dict = get_model_as_dict(model)
restored_model = get_or_create(model_dict, models.AppBskyGraphGetFollows.Response)
Expand Down
13 changes: 9 additions & 4 deletions tests/models/tests/test_is_record_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
from atproto.xrpc_client.models.dot_dict import DotDict
from tests.models.tests.utils import load_data_from_file

TEST_DATA_LEXICON_CORRECT = load_data_from_file('post_record')
TEST_DATA_EXTENDED_LEXICON = load_data_from_file('custom_post_record')

def load_test_correct_data() -> dict:
return load_data_from_file('post_record')


def load_test_extended_data() -> dict:
return load_data_from_file('custom_post_record')


def test_is_record_type():
lexicon_correct_post_record = get_or_create(TEST_DATA_LEXICON_CORRECT, models.ComAtprotoRepoGetRecord.Response)
extended_post_record = get_or_create(TEST_DATA_EXTENDED_LEXICON, models.ComAtprotoRepoGetRecord.Response)
lexicon_correct_post_record = get_or_create(load_test_correct_data(), models.ComAtprotoRepoGetRecord.Response)
extended_post_record = get_or_create(load_test_extended_data(), models.ComAtprotoRepoGetRecord.Response)

assert isinstance(lexicon_correct_post_record.value, models.AppBskyFeedPost.Main)
assert is_record_type(lexicon_correct_post_record.value, models.ids.AppBskyFeedPost) is True
Expand Down
8 changes: 5 additions & 3 deletions tests/models/tests/test_like_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
from atproto.xrpc_client.models import get_model_as_dict, get_or_create
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('like_record')

def load_test_data() -> dict:
return load_data_from_file('like_record')


def test_like_record_deserialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

assert isinstance(model, models.ComAtprotoRepoGetRecord.Response)
assert isinstance(model.value, models.AppBskyFeedLike.Main)
Expand All @@ -32,7 +34,7 @@ def test_like_record_deserialization():


def test_like_record_serialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

model_dict = get_model_as_dict(model)
restored_model = get_or_create(model_dict, models.ComAtprotoRepoGetRecord.Response)
Expand Down
8 changes: 5 additions & 3 deletions tests/models/tests/test_post_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
from atproto.xrpc_client.models import get_model_as_dict, get_or_create
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('post_record')

def load_test_data() -> dict:
return load_data_from_file('post_record')


def test_post_record_deserialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

assert isinstance(model, models.ComAtprotoRepoGetRecord.Response)
assert isinstance(model.value, models.AppBskyFeedPost.Main)
Expand All @@ -32,7 +34,7 @@ def test_post_record_deserialization():


def test_post_record_serialization():
model = get_or_create(TEST_DATA, models.ComAtprotoRepoGetRecord.Response)
model = get_or_create(load_test_data(), models.ComAtprotoRepoGetRecord.Response)

model_dict = get_model_as_dict(model)
restored_model = get_or_create(model_dict, models.ComAtprotoRepoGetRecord.Response)
Expand Down
8 changes: 5 additions & 3 deletions tests/models/tests/test_resolve_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
from atproto.xrpc_client.models import get_model_as_dict, get_or_create
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('resolve_handle')

def load_test_data() -> dict:
return load_data_from_file('resolve_handle')


def test_resolve_handle_deserialization():
model = get_or_create(TEST_DATA, models.ComAtprotoIdentityResolveHandle.Response)
model = get_or_create(load_test_data(), models.ComAtprotoIdentityResolveHandle.Response)

assert isinstance(model, models.ComAtprotoIdentityResolveHandle.Response)
assert isinstance(model.did, str)
Expand All @@ -18,7 +20,7 @@ def test_resolve_handle_deserialization():


def test_resolve_handle_serialization():
model = get_or_create(TEST_DATA, models.ComAtprotoIdentityResolveHandle.Response)
model = get_or_create(load_test_data(), models.ComAtprotoIdentityResolveHandle.Response)

model_dict = get_model_as_dict(model)
restored_model = get_or_create(model_dict, models.ComAtprotoIdentityResolveHandle.Response)
Expand Down
8 changes: 5 additions & 3 deletions tests/models/tests/test_thread_view_post_with_embed_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
from atproto.xrpc_client.models import get_model_as_dict, get_or_create
from tests.models.tests.utils import load_data_from_file

TEST_DATA = load_data_from_file('thread_view_post_with_embed_media')

def load_test_data() -> dict:
return load_data_from_file('thread_view_post_with_embed_media')


def test_thread_view_post_with_embed_media_deserialization():
model = get_or_create(TEST_DATA, models.AppBskyFeedGetPostThread.Response)
model = get_or_create(load_test_data(), models.AppBskyFeedGetPostThread.Response)

assert isinstance(model, models.AppBskyFeedGetPostThread.Response)
assert isinstance(model.thread, models.AppBskyFeedDefs.ThreadViewPost)
Expand All @@ -23,7 +25,7 @@ def test_thread_view_post_with_embed_media_deserialization():


def test_thread_view_post_with_embed_media_serialization():
model = get_or_create(TEST_DATA, models.AppBskyFeedGetPostThread.Response)
model = get_or_create(load_test_data(), models.AppBskyFeedGetPostThread.Response)
model_dict = get_model_as_dict(model)

restored_model = get_or_create(model_dict, models.AppBskyFeedGetPostThread.Response)
Expand Down

0 comments on commit 9ffc6d1

Please sign in to comment.