Skip to content

Commit 42f6134

Browse files
authored
Merge pull request #295 from digital-asset/python-fix-create-and-exercise
python: Fix Connection.create_and_exercise.
2 parents e36b932 + 6f2e361 commit 42f6134

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.5.13
1+
7.5.14

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[tool.poetry]
55
name = "dazl"
6-
version = "7.5.13"
6+
version = "7.5.14"
77
description = "high-level Ledger API client for Daml ledgers"
88
license = "Apache-2.0"
99
authors = ["Davin K. Tanabe <davin.tanabe@digitalasset.com>"]

python/dazl/ledger/grpc/codec_aio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ async def encode_create_and_exercise_command(
139139
item_type, _, choice = await self._look_up_choice(template_id, choice_name)
140140

141141
payload_field, payload_pb = await self.encode_value(con(item_type), payload)
142-
if payload_pb != "record":
142+
if payload_field != "record":
143143
raise ValueError("unexpected non-record type when constructing payload")
144144
argument_field, argument_pb = await self.encode_value(choice.arg_binder.type, argument)
145145
cmd_pb = lapipb.CreateAndExerciseCommand(

python/tests/unit/test_connection_command_submission.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,37 @@ async def test_exercise_by_key(sandbox):
4242
)
4343

4444
logging.info("Choice result: %r", result.result)
45+
46+
47+
@pytest.mark.asyncio
48+
async def test_create_and_exercise(sandbox):
49+
async with connect_with_new_party(url=sandbox, dar=KitchenSink) as p:
50+
result = await p.connection.create_and_exercise(
51+
"KitchenSink.Retailer:Retailer",
52+
{
53+
"retailer": p.party,
54+
"name": "Kitchen Sinks R Us",
55+
"website": "kitchensinksrus.local",
56+
},
57+
"UpdateWebsite",
58+
{"newWebsite": "kitchensinksrus.com"},
59+
)
60+
61+
logging.info("Choice result: %r", result.result)
62+
63+
64+
@pytest.mark.asyncio
65+
async def test_create_and_exercise_unit_arg(sandbox):
66+
async with connect_with_new_party(url=sandbox, dar=KitchenSink) as p:
67+
result = await p.connection.create_and_exercise(
68+
"KitchenSink.Retailer:Order",
69+
{
70+
"customer": p.party,
71+
"payment": 0,
72+
"retailer": p.party,
73+
"expedite": False,
74+
},
75+
"MarkAsShipped",
76+
)
77+
78+
logging.info("Choice result: %r", result.result)

0 commit comments

Comments
 (0)