def __init__(self, template_name): self.lookup = MultiPackageLookup() self.loader = PackageLoader(self.lookup, DarFile(AllKindsOf)) self.call_order = [] self.template_name = template_name # the lookup should always start out empty assert len(self.lookup.archives()) == 0
def test_wildcard_template_names(): with DarFile(AllKindsOf) as dar: lookup = MultiPackageLookup(dar.archives()) # make sure that looking for templates, wildcarded by package ref, actually work and return # things names = [ name for ref in lookup.package_ids() for name in lookup.template_names(f"{ref}:*") ] assert len(names) == 2
def dar_fixture() -> "DarFixture": with DarFile(Pending) as dar: lookup = MultiPackageLookup(dar.archives()) yield DarFixture(dar, lookup)
def test_dar_version_compatibility(dar): short_dar = dar.relative_to(ARCHIVES) dar_file = DarFile(dar) archives = dar_file.archives() LOG.info("Successfully read %s with package IDs %r.", short_dar, [a.hash for a in archives])
def load_some_bytes(): with DarFile(AllKindsOf) as dar: # noinspection PyProtectedMember for a in dar._pb_archives(): return a.hash, a.payload raise Exception()
def test_get_sdk_version(): with DarFile(Pending) as dar: print(dar.manifest()) assert "1.3.0" == dar.sdk_version()
def test_render_metadata(): with DarFile(Pending) as dar: pp = DamlPrettyPrinter(lookup=MultiPackageLookup(dar.archives()), context=PrettyOptions(show_hidden_types=True)) pp.render_store()