本文整理匯總了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`.