当前位置: 首页>>代码示例>>Python>>正文


Python DependencyTracker.resources方法代码示例

本文整理汇总了Python中cfgm_common.dependency_tracker.DependencyTracker.resources方法的典型用法代码示例。如果您正苦于以下问题:Python DependencyTracker.resources方法的具体用法?Python DependencyTracker.resources怎么用?Python DependencyTracker.resources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cfgm_common.dependency_tracker.DependencyTracker的用法示例。


在下文中一共展示了DependencyTracker.resources方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_basic_dep_track_update_1

# 需要导入模块: from cfgm_common.dependency_tracker import DependencyTracker [as 别名]
# 或者: from cfgm_common.dependency_tracker.DependencyTracker import resources [as 别名]
    def test_basic_dep_track_update_1(self):
        reaction_map = {
            "red": {
                'self': ['green', 'blue'],
            },
            "blue": {
                'self': ['green'],
                'red': ['blue'],
                'purple': ['green'],
                'green': [],
            },
            "green": {
                'self': ['white'],
                'blue': ['white'],
                'red': ['blue'],
            },
            "white": {
                'self': ['purple'],
                'green': ['purple'],
            },
            "purple": {
                'self': ['blue'],
                'white': ['blue'],
            },
        }
        GreenSM._object_db.object_read = self.green_read_with_refs
        WhiteSM._object_db.object_read = self.white_read_with_refs
        BlueSM._object_db.object_read = self.purple_read_with_multi_refs
        BlueSM._object_db.object_read = self.blue_read_with_multi_refs
        dependency_tracker = DependencyTracker(DBBase._OBJ_TYPE_MAP, reaction_map)
        red = RedSM.locate("fake-red-uuid")
        blue = BlueSM.locate("fake-blue-uuid")
        green = GreenSM.locate("fake-green-uuid-0")
        GreenSM.locate("fake-green-uuid-1")
        white = WhiteSM.locate("fake-white-uuid")
        purple = PurpleSM.locate("fake-purple-uuid")
        dependency_tracker.evaluate('red', red)
        GreenSM.delete("fake-green-uuid-0")
        GreenSM.delete("fake-green-uuid-1")

        GreenSM.locate("fake-green-uuid-2")
        GreenSM.locate("fake-green-uuid-3")
        BlueSM._object_db.object_read = self.blue_read_with_new_refs
        blue.update()
        dependency_tracker.resources = {}
        dependency_tracker.evaluate('red', red)
        self.assertEqual(len(dependency_tracker.resources), 3)
        self.assertTrue("blue" in dependency_tracker.resources)
        self.assertTrue("green" in dependency_tracker.resources)
        self.assertTrue("red" in dependency_tracker.resources)
        self.assertEqual(set(dependency_tracker.resources["green"]), set(["fake-green-uuid-2", "fake-green-uuid-3"]))
        self.assertEqual(dependency_tracker.resources["blue"], ["fake-blue-uuid"])
        self.assertEqual(dependency_tracker.resources["red"], ["fake-red-uuid"])
        RedSM.delete("fake-red-uuid")
        GreenSM.delete("fake-green-uuid-2")
        GreenSM.delete("fake-green-uuid-3")
        BlueSM.delete("fake-blue-uuid")
        WhiteSM.delete("fake-white-uuid")
        PurpleSM.delete("fake-purple-uuid")
开发者ID:,项目名称:,代码行数:61,代码来源:


注:本文中的cfgm_common.dependency_tracker.DependencyTracker.resources方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。