How to use the ubiquerg.powerset function in ubiquerg

To help you get started, we’ve selected a few ubiquerg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github databio / pypiper / tests / utils_tests / test_check_command_callability.py View on Github external
    "commands", powerset(["ls", "picard.jar", "$ENVVAR"], nonempty=True))
def test_transformation_accumulation(commands):
    """ Accumulation of transformations works as expected """
    mapjar = lambda c: "java -jar {}".format(c)
    envjar = "env.jar"
    transforms = [(lambda c: c == "$ENVVAR", lambda _: envjar),
                  (lambda c: c.endswith(".jar"), mapjar)]
    exps = {"ls": "ls", "picard.jar": mapjar("picard.jar"), "$ENVVAR": mapjar(envjar)}
    with mock.patch.object(piper_utils, "is_command_callable", return_value=False):
        res = piper_utils.determine_uncallable(
            commands, transformations=transforms, accumulate=True)
    expectation = [(c, exps[c]) for c in commands]
    print("EXPECTED: {}".format(expectation))
    print("OBSERVED: {}".format(res))
    assert expectation == res
github pepkit / peppy / oldtests / test_utils.py View on Github external
        argvalues=powerset(
            [{NEW_PIPES_KEY: [{"b": 1}, {"c": 2}]}, {"pipeline_config": {}}],
            nonempty=True))
    def test_grabs_only_sample_independent_data(
            self, sample_independent_data, extra_data):
        """ Only Project data defined as Sample-independent is retrieved. """

        # Create the data to pass the the argument to the call under test.
        data = copy.deepcopy(sample_independent_data)
        data_updates = {}
        for extra in extra_data:
            data_updates.update(extra)
        data.update(data_updates)

        # Convert to the correct argument type for this test case.
        p = PathExAttMap(data)
github pepkit / peppy / oldtests / test_utils.py View on Github external
        argvalues=powerset(SAMPLE_INDEPENDENT_PROJECT_SECTIONS, nonempty=True))
    def test_does_not_need_all_sample_independent_data(
            self, sections, basic_project_data, sample_independent_data):
        """ Subset of all known independent data that's present is grabbed. """
        p = PathExAttMap(sample_independent_data)
        expected = {s: data for s, data in basic_project_data.items()
                    if s in sections}
        observed = grab_project_data(p)
        compare_mappings(expected, observed)