本文整理汇总了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'],
#.........这里部分代码省略.........