コード例 #1
0
async def test_complicated_map_support(sandbox):
    # This test will be re-enabled when GenMap support lands in DAML-LF 1.9
    async with async_network(url=sandbox, dars=MapSupport) as network:
        client = network.aio_new_party()

        await client.ready()
        await client.create(
            "MapSupport:ComplicatedSample",
            {
                "party": "Test",
                # Note: Python `dict`s are not hashable, so the only way to write this out
                # is to create a special dict as a key
                "keyIsMap": {
                    frozendict(A="b"): "mmm"
                },
                "keyIsRecord": {
                    frozendict(x=2, y=4): "rrr"
                },
                "keyIsRecordWithTypeParam": {
                    frozendict(x=2, y=4): "rrr"
                },
                "keyIsVariant": {
                    frozendict(Apple=""): "ttt"
                },
            },
        )

        assert len(client.find_active("*")) == 1
コード例 #2
0
def test_complicated_map_support():
    with sandbox(MapSupport) as proc:
        with simple_client(url=proc.url, party='Test') as client:
            client.ready()
            client.submit_create(
                'MapSupport.ComplicatedSample',
                {
                    'party': 'Test',
                    # Note: Python `dict`s are not hashable, so the only way to write this out
                    # is to create a special dict as a key
                    'keyIsMap': {
                        frozendict(A='b'): 'mmm'
                    },
                    'keyIsRecord': {
                        frozendict(x=2, y=4): 'rrr'
                    },
                    'keyIsRecordWithTypeParam': {
                        frozendict(x=2, y=4): 'rrr'
                    },
                    'keyIsVariant': {
                        frozendict(Apple=''): 'ttt'
                    }
                })

            logging.info(client.find_active('*'))
コード例 #3
0
async def test_complicated_map_support(sandbox):
    # This test will be re-enabled when GenMap support lands in DAML-LF 1.9
    async with async_network(url=sandbox, dars=MapSupport) as network:
        client = network.aio_new_party()

        await client.ready()
        await client.submit_create(
            'MapSupport:ComplicatedSample',
            {
                'party': 'Test',
                # Note: Python `dict`s are not hashable, so the only way to write this out
                # is to create a special dict as a key
                'keyIsMap': {
                    frozendict(A='b'): 'mmm'
                },
                'keyIsRecord': {
                    frozendict(x=2, y=4): 'rrr'
                },
                'keyIsRecordWithTypeParam': {
                    frozendict(x=2, y=4): 'rrr'
                },
                'keyIsVariant': {
                    frozendict(Apple=''): 'ttt'
                }
            })

        assert len(client.find_active('*')) == 1