def test_type_con_name(): a = PackageRef( "deadbeef00000000000000000000000000000000000000000000000000000000") con1 = TypeConName(module=ModuleRef(a, DottedName(["Some", "Module"])), name=["Iou"]) con2 = TypeConName(module=ModuleRef(a, DottedName(["Some", "Module"])), name=["Iou"]) assert con1 == con2 assert hash(con1) == hash(con2)
def test_render_update_of_contract_type_con(): module_ref = ModuleRef( package_id=PackageRef("00000000000000000000000000000000"), module_name=DottedName(("ABC", ))) name = TypeConName(module=module_ref, name=("DefGhi", )) type_ = daml.Update(daml.ContractId(daml.con(name))) expected = "Update (ContractId ABC:DefGhi)" actual = str(type_) assert expected == actual
def test_render_update_of_contract_type_con_old(): from dazl.model.types import ContractIdType, UpdateType, ModuleRef, TypeReference module_ref = ModuleRef( package_id=PackageRef('00000000000000000000000000000000'), module_name=DottedName(('ABC', ))) type_ref = TypeReference( con=TypeConName(module=module_ref, name=('DefGhi', ))) type_ = UpdateType(ContractIdType(type_ref)) expected = 'Update (ContractId ABC:DefGhi)' actual = str(type_) assert expected == actual
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=PackageRef('00000000000000000000000000000000'), module_name=DottedName(('ABC', ))) con_type = Type(con=Type.Con( tycon=TypeConName(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