Skip to content

Commit 98d0249

Browse files
committed
♻️ refactor: replace dict() method with model_dump() in account_info_command.py, query_command.py, submit_command.py, and test_api.py for better data serialization and deserialization
1 parent 9baf4a5 commit 98d0249

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

convex_api/tool/command/account_info_command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ def execute(self, args: Namespace, output: Output):
5858
output.set_value('address', info['address'])
5959
if info['name']:
6060
output.set_value('name', info['name'])
61-
output.add_line_values(account_info.dict())
62-
output.set_values(account_info.dict())
61+
output.add_line_values(account_info.model_dump())
62+
output.set_values(account_info.model_dump())

convex_api/tool/command/query_command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ def execute(self, args: Namespace, output: Output):
6565

6666
address = 1
6767
result = convex.query(query_args.query, address)
68-
output.add_line(result.json())
69-
output.set_values(result.dict())
68+
output.add_line(result.model_dump_json())
69+
output.set_values(result.model_dump())

convex_api/tool/command/submit_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ def execute(self, args: Namespace, output: Output):
6565
return
6666

6767
output.add_line(result.model_dump_json())
68-
output.set_values(result.dict())
68+
output.set_values(result.model_dump())

tests/intergration/test_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_convex_transfer_account(convex_url: str, test_account: Account):
9898
convex.topup_account(account_1)
9999
result = convex.send('(map inc [1 2 3 4 5])', account_1)
100100
assert(result is not None)
101-
assert 'value' in result.dict()
101+
assert 'value' in result.model_dump()
102102
assert(result.value == [2, 3, 4, 5, 6])
103103

104104
# transfer the new account_1 to use the same keys as the test_account
@@ -112,7 +112,7 @@ def test_convex_transfer_account(convex_url: str, test_account: Account):
112112
# test out new key
113113
result = convex.send('(map inc [1 2 3 4 5])', account_1_change)
114114
assert(result is not None)
115-
assert 'value' in result.dict()
115+
assert 'value' in result.model_dump()
116116
assert(result.value == [2, 3, 4, 5, 6])
117117

118118

@@ -122,7 +122,7 @@ def test_convex_api_send_basic_lisp(convex_url: str, test_account: Account):
122122
assert(request_amount == TEST_FUNDING_AMOUNT)
123123
result = convex.send('(map inc [1 2 3 4 5])', test_account)
124124
assert(result is not None)
125-
assert 'value' in result.dict()
125+
assert 'value' in result.model_dump()
126126
assert(result.value == [2, 3, 4, 5, 6])
127127

128128
def test_convex_api_get_balance_no_funds(convex_url: str):

0 commit comments

Comments
 (0)