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


Python RevisionMap._get_base_revisions方法代码示例

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


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

示例1: LabeledBranchTest

# 需要导入模块: from alembic.script.revision import RevisionMap [as 别名]
# 或者: from alembic.script.revision.RevisionMap import _get_base_revisions [as 别名]
class LabeledBranchTest(DownIterateTest):
    def test_dupe_branch_collection(self):
        fn = lambda: [
            Revision('a', ()),
            Revision('b', ('a',)),
            Revision('c', ('b',), branch_labels=['xy1']),
            Revision('d', ()),
            Revision('e', ('d',), branch_labels=['xy1']),
            Revision('f', ('e',))
        ]
        assert_raises_message(
            RevisionError,
            r"Branch name 'xy1' in revision (?:e|c) already "
            "used by revision (?:e|c)",
            getattr, RevisionMap(fn), "_revision_map"
        )

    def test_filter_for_lineage_labeled_head_across_merge(self):
        fn = lambda: [
            Revision('a', ()),
            Revision('b', ('a', )),
            Revision('c1', ('b', ), branch_labels='c1branch'),
            Revision('c2', ('b', )),
            Revision('d', ('c1', 'c2')),

        ]
        map_ = RevisionMap(fn)
        c1 = map_.get_revision('c1')
        c2 = map_.get_revision('c2')
        d = map_.get_revision('d')
        eq_(
            map_.filter_for_lineage([c1, c2, d], "[email protected]"),
            [c1, c2, d]
        )

    def test_filter_for_lineage_heads(self):
        eq_(
            self.map.filter_for_lineage(
                [self.map.get_revision("f")],
                "heads"
            ),
            [self.map.get_revision("f")]
        )

    def setUp(self):
        self.map = RevisionMap(lambda: [
            Revision('a', (), branch_labels='abranch'),
            Revision('b', ('a',)),
            Revision('somelongername', ('b',)),
            Revision('c', ('somelongername',)),
            Revision('d', ()),
            Revision('e', ('d',), branch_labels=['ebranch']),
            Revision('someothername', ('e',)),
            Revision('f', ('someothername',)),
        ])

    def test_get_base_revisions_labeled(self):
        eq_(
            self.map._get_base_revisions("[email protected]"),
            ['a']
        )

    def test_get_current_named_rev(self):
        eq_(
            self.map.get_revision("[email protected]"),
            self.map.get_revision("f")
        )

    def test_get_base_revisions(self):
        eq_(
            self.map._get_base_revisions("base"),
            ['a', 'd']
        )

    def test_iterate_head_to_named_base(self):
        self._assert_iteration(
            "heads", "[email protected]",
            ['f', 'someothername', 'e', 'd']
        )

        self._assert_iteration(
            "heads", "[email protected]",
            ['c', 'somelongername', 'b', 'a']
        )

    def test_iterate_named_head_to_base(self):
        self._assert_iteration(
            "[email protected]", "base",
            ['f', 'someothername', 'e', 'd']
        )

        self._assert_iteration(
            "[email protected]", "base",
            ['c', 'somelongername', 'b', 'a']
        )

    def test_iterate_named_head_to_heads(self):
        self._assert_iteration(
            "heads", "[email protected]",
            ['f'],
#.........这里部分代码省略.........
开发者ID:RazerM,项目名称:alembic,代码行数:103,代码来源:test_revision.py


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