本文整理汇总了Python中parameterized.parameterized.expand方法的典型用法代码示例。如果您正苦于以下问题:Python parameterized.expand方法的具体用法?Python parameterized.expand怎么用?Python parameterized.expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parameterized.parameterized
的用法示例。
在下文中一共展示了parameterized.expand方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_generic_test
# 需要导入模块: from parameterized import parameterized [as 别名]
# 或者: from parameterized.parameterized import expand [as 别名]
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
示例2: exist_perms
# 需要导入模块: from parameterized import parameterized [as 别名]
# 或者: from parameterized.parameterized import expand [as 别名]
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)
示例3: true_false_perms
# 需要导入模块: from parameterized import parameterized [as 别名]
# 或者: from parameterized.parameterized import expand [as 别名]
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
示例4: test_gym_offline_cpu
# 需要导入模块: from parameterized import parameterized [as 别名]
# 或者: from parameterized.parameterized import expand [as 别名]
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`.
示例5: test_gym_cpu
# 需要导入模块: from parameterized import parameterized [as 别名]
# 或者: from parameterized.parameterized import expand [as 别名]
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`.