Beispiel #1
0
@_test_op
def _to_i64(x: Number) -> Int[64]:
    return int(x)


infer_pipeline = scalar_pipeline.select('parse', 'infer').configure({
    'py_implementations':
    pyimpl_test,
    'inferrer.constructors':
    abstract_inferrer_cons_test,
})

infer_pipeline_std = standard_pipeline.select('parse', 'infer').configure({
    'py_implementations':
    pyimpl_test,
    'inferrer.constructors':
    abstract_inferrer_cons_test,
})


def _is_exc_type(cls):
    return isinstance(cls, type) and issubclass(cls, Exception)


def inferrer_decorator(pipeline):
    def infer(*tests):

        tests = [[to_abstract_test(x) for x in test] for test in tests]

        def decorate(fn):
            def run_test(spec):
Beispiel #2
0

@overload  # noqa: F811
def eqtest(x: type(None), y, **kwargs):
    if y is None:
        return True
    else:
        return (y == 0).all()


@overload  # noqa: F811
def eqtest(x: object, y, **kwargs):
    return x == y


infer_pipeline = standard_pipeline.select('resources', 'parse', 'infer')


class Multiple:
    def __init__(self, *params, **options):
        self.options = []
        for i, param in enumerate(params):
            assert isinstance(param, ParameterSet)
            self.options.append((self, param.id, param.marks, param.values[0]))
        self.options += [(self, id, [], v) for id, v in options.items()]


def mt(*tests, **kwargs):
    """Multitest.

    All MyiaFunctionTest instances in the list of tests will be run on the same
Beispiel #3
0

@overload  # noqa: F811
def eqtest(x: type(None), y, **kwargs):
    if y is None:
        return True
    else:
        return (y == 0).all()


@overload  # noqa: F811
def eqtest(x: object, y, **kwargs):
    return x == y


infer_pipeline = standard_pipeline.select("resources", "parse", "infer")


class Multiple:
    def __init__(self, *params, **options):
        self.options = []
        for i, param in enumerate(params):
            assert isinstance(param, ParameterSet)
            self.options.append((self, param.id, param.marks, param.values[0]))
        self.options += [(self, id, [], v) for id, v in options.items()]


def mt(*tests, **kwargs):
    """Multitest.

    All MyiaFunctionTest instances in the list of tests will be run on the same
Beispiel #4
0
    10,
    'inferrer.tracks.value.constructors':
    value_inferrer_cons_test,
    'inferrer.tracks.type.constructors':
    type_inferrer_cons_test,
    'inferrer.tracks.shape.constructors':
    shape_inferrer_cons_test,
})

infer_pipeline_std = standard_pipeline.select('parse', 'infer').configure({
    'py_implementations':
    pyimpl_test,
    'inferrer.erase_value':
    False,
    'inferrer.tracks.value.max_depth':
    10,
    'inferrer.tracks.value.constructors':
    value_inferrer_cons_test,
    'inferrer.tracks.type.constructors':
    type_inferrer_cons_test,
    'inferrer.tracks.shape.constructors':
    shape_inferrer_cons_test,
})


def _is_exc_type(cls):
    return isinstance(cls, type) and issubclass(cls, Exception)


def parse_test_spec(tests_spec):

    tests = []