コード例 #1
0
ファイル: core.py プロジェクト: GermanMT/benchmarking
def exec(model):
    # Create the manager
    dm = DiscoverMetamodels()
    # Read the model
    fm = dm.use_transformation_t2m(src=model, dst='fm')
    # Print the model
    #print(fm)
    # Transform to Python-sat metamodel
    pysatm = dm.use_transformation_m2m(src=fm, dst='pysat')
    # Operation execute return the object instance
    operation = dm.use_operation(src=pysatm, operation='DeadFeatures')
    # Print the result
    print("Result:", str(operation.get_result()))
コード例 #2
0
    def test_discover_apply_functions(self, mocker):
        mocker.return_value = [one_plugin]
        search = DiscoverMetamodels()

        with raises(PluginNotFound) as error:
            search.use_transformation_t2m(src='file.ext', dst='foo')
        assert error.typename == 'PluginNotFound'

        variability_model = search.use_transformation_t2m(src='file.ext',
                                                          dst='ext')

        text = search.use_transformation_m2t(src=variability_model,
                                             dst='file.ext')

        search.use_transformation_m2m(src=variability_model, dst='ext')

        operation = search.use_operation(src=variability_model,
                                         operation='Operation1')

        assert isinstance(variability_model, VariabilityModel)
        assert text == 'example'
        assert operation.get_result() == '123456'
コード例 #3
0
from famapy.core.discover import DiscoverMetamodels

# create the manager
dm = DiscoverMetamodels()

# Example t2m
fm = dm.use_transformation_t2m(src='example.xml', dst='fm')
print(fm)

# Example m2t
dm.use_transformation_m2t(src=fm, dst='output.json')

# Example m2m
# TODO: create VariabilityModel and get src extension
# todo debe haber alguna forma de pasarle el modelo cargado a la transformacion
# y que te lo devuelva en pysast
# dm.use_transformation_m2m(src=VariabilityModel, dst='pysat')
pysatm = dm.use_transformation_m2m(src=fm, dst='pysat')
print(pysatm)

# operation execute return the object instance
operation = dm.use_operation(src=pysatm, operation='Valid')
print("Result operation valid:", operation.is_valid())