Python parameterized.parameterized.expand() Examples

The following are 5 code examples of parameterized.parameterized.expand(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module parameterized.parameterized , or try the search function .
Example #1
Source File: generic_test.py    From cadCAD with MIT License 5 votes vote down vote up
def make_generic_test(params):
    class TestSequence(unittest.TestCase):
        # pprint(params)

        def generic_test(self, tested_df, expected_reults, test_name):
            erroneous = tested_df[(tested_df[test_name] == False)]
            print(tabulate(tested_df, headers='keys', tablefmt='psql'))

            if erroneous.empty is False:  # Or Entire df IS NOT erroneous
                for index, row in erroneous.iterrows():
                    expected = expected_reults[(row['simulation'], row['run'], row['timestep'], row['substep'])]
                    unexpected = {f"invalid_{k}": expected[k] for k in expected if k in row and expected[k] != row[k]}

                    for key in unexpected.keys():
                        erroneous[key] = None
                        erroneous.at[index, key] = unexpected[key]
                # etc.

            self.assertTrue(reduce(lambda a, b: a and b, tested_df[test_name]))

        @parameterized.expand(params)
        def test_validation(self, name, result_df, expected_results, target_cols, evaluations):
            tested_df, test_names = generate_assertions_df(result_df, expected_results, target_cols, evaluations)

            for test_name in test_names:
                self.generic_test(tested_df, expected_results, test_name)

    return TestSequence 
Example #2
Source File: test_high_level.py    From python-gssapi with ISC License 5 votes vote down vote up
def exist_perms(**kwargs):
    all_elems = list(kwargs.keys())
    curr_elems = copy.deepcopy(all_elems)

    perms = _perms_cycle(curr_elems.pop(), curr_elems, {})
    res = []
    for name_str, perm in perms:
        args = dict([(k, v) for (k, v) in kwargs.items() if perm[k]])
        res.append((name_str, args))

    return parameterized.expand(res) 
Example #3
Source File: test_high_level.py    From python-gssapi with ISC License 5 votes vote down vote up
def true_false_perms(*all_elems_tuple):
    all_elems = list(all_elems_tuple)
    curr_elems = copy.deepcopy(all_elems)

    perms = _perms_cycle(curr_elems.pop(), curr_elems, {})
    return parameterized.expand(perms)


# NB(directxman12): MIT Kerberos completely ignores input TTLs for
#                   credentials.  I suspect this is because the TTL
#                   is actually set when kinit is called.
# NB(directxman12): the above note used to be wonderfully sarcastic 
Example #4
Source File: test_gym_offline.py    From ReAgent with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_gym_offline_cpu(self, name: str, config_path: str):
        self.run_from_config(
            run_test=run_test_offline,
            config_path=os.path.join(curr_dir, config_path),
            use_gpu=False,
        )
        logger.info(f"{name} passes!")

    # pyre-fixme[16]: Module `parameterized` has no attribute `expand`. 
Example #5
Source File: test_gym.py    From ReAgent with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_gym_cpu(self, name: str, config_path: str):
        self.run_from_config(
            run_test=run_test,
            config_path=os.path.join(curr_dir, config_path),
            use_gpu=False,
        )
        logger.info(f"{name} passes!")

    # pyre-fixme[16]: Module `parameterized` has no attribute `expand`.