當前位置: 首頁>>代碼示例>>Python>>正文


Python parameterized.expand方法代碼示例

本文整理匯總了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 
開發者ID:cadCAD-org,項目名稱:cadCAD,代碼行數:30,代碼來源:generic_test.py

示例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) 
開發者ID:pythongssapi,項目名稱:python-gssapi,代碼行數:13,代碼來源:test_high_level.py

示例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 
開發者ID:pythongssapi,項目名稱:python-gssapi,代碼行數:14,代碼來源:test_high_level.py

示例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`. 
開發者ID:facebookresearch,項目名稱:ReAgent,代碼行數:11,代碼來源:test_gym_offline.py

示例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`. 
開發者ID:facebookresearch,項目名稱:ReAgent,代碼行數:11,代碼來源:test_gym.py


注:本文中的parameterized.parameterized.expand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。