Example #1
0
def test_coverage():
    methods = module_functions(fn, remove_prefix = "nvidia.dali.fn")
    methods += module_functions(dmath, remove_prefix = "nvidia.dali")
    covered = tested_methods + excluded_methods
    print(set(methods) - set(covered))
    # we are fine with covering more we can easily list, like numba
    assert set(methods).difference(set(covered)) == set(), "Test doesn't cover:\n {}".format(set(methods) - set(covered))
Example #2
0
def test_coverage():
    methods = module_functions(fn, remove_prefix="nvidia.dali.fn")
    methods += module_functions(dmath, remove_prefix="nvidia.dali")
    exclude = "|".join([
        "(^" + x.replace(".", r"\.").replace("*", ".*").replace("?", ".") +
        "$)" for x in excluded_methods
    ])
    exclude = re.compile(exclude)
    methods = [x for x in methods if not exclude.match(x)]
    # we are fine with covering more we can easily list, like numba
    assert set(methods).difference(set(tested_methods)) == set(), \
        "Test doesn't cover:\n {}".format(set(methods) - set(tested_methods))
def test_coverage():
    """ Checks coverage of eager operators (almost every operator is also exposed in eager mode).
    If you added a new operator, you should also add a test for it here and add the operator name
    to the ``tested_methods`` list. You should also add eager classification for your operator in
    `dali/python/nvidia/dali/_utils/eager_utils.py`.
    """

    methods = module_functions(eager, remove_prefix="nvidia.dali.experimental.eager")
    methods += module_functions(
        eager.rng_state(), remove_prefix='rng_state', check_non_module=True)
    # TODO(ksztenderski): Add coverage for GPU operators.
    exclude = "|".join(
        ["(^" + x.replace(".", "\.").replace("*", ".*").replace("?", ".") + "$)"  # noqa: W605
         for x in excluded_methods])
    exclude = re.compile(exclude)
    methods = [x for x in methods if not exclude.match(x)]

    assert set(methods).difference(set(tested_methods)) == set(
    ), "Test doesn't cover:\n {}".format(set(methods) - set(tested_methods))