Example #1
0
def test_render_update_of_contract_type_con_new():
    from dazl.damlast.daml_lf_1 import PrimType, Type
    from dazl.model.types import ModuleRef, TypeReference

    module_ref = ModuleRef(package_id='00000000000000000000000000000000',
                           module_name=('ABC', ))
    con_type = Type(con=Type.Con(
        tycon=TypeReference(module=module_ref, name=('DefGhi', )), args=()))
    cid_type = Type(
        prim=Type.Prim(prim=PrimType.CONTRACT_ID, args=(con_type, )))
    type_ = Type(prim=Type.Prim(prim=PrimType.UPDATE, args=(cid_type, )))

    expected = 'Update (ContractId ABC:DefGhi)'
    actual = str(type_)

    assert expected == actual
Example #2
0
    def test_render_list_of_contract_type_con_new(self):
        from dazl.damlast.daml_lf_1 import PrimType, Type
        from dazl.model.types import ModuleRef, TypeReference

        module_ref = ModuleRef(package_id='00000000000000000000000000000000',
                               module_name=('ABC', ))
        con_type = Type(con=Type.Con(
            tycon=TypeReference(module=module_ref, name=(
                'DefGhi', )), args=()))
        cid_type = Type(
            prim=Type.Prim(prim=PrimType.CONTRACT_ID, args=(con_type, )))
        type_ = Type(prim=Type.Prim(prim=PrimType.LIST, args=(cid_type, )))

        expected = '[ContractId ABC:DefGhi]'
        actual = str(type_)

        self.assertEqual(expected, actual)