本文整理匯總了Python中alembic.script.revision.RevisionMap._get_ancestor_nodes方法的典型用法代碼示例。如果您正苦於以下問題:Python RevisionMap._get_ancestor_nodes方法的具體用法?Python RevisionMap._get_ancestor_nodes怎麽用?Python RevisionMap._get_ancestor_nodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類alembic.script.revision.RevisionMap
的用法示例。
在下文中一共展示了RevisionMap._get_ancestor_nodes方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: BranchTravellingTest
# 需要導入模塊: from alembic.script.revision import RevisionMap [as 別名]
# 或者: from alembic.script.revision.RevisionMap import _get_ancestor_nodes [as 別名]
#.........這裏部分代碼省略.........
] # noqa
)
def test_two_branches_end_behind_branch(self):
self._assert_iteration(
"merge", "a2",
['merge',
'e2b1', 'db1', 'cb1', 'b1', # e2b1 branch
'e2b2', 'db2', 'cb2', 'b2', # e2b2 branch
'a3', # both terminate at a3
'a2'
] # noqa
)
def test_three_branches_to_root(self):
# in this case, both "a3" and "db1" are stop points
self._assert_iteration(
["merge", "fe1b1"], "a1",
['merge',
'e2b1', # e2b1 branch
'e2b2', 'db2', 'cb2', 'b2', # e2b2 branch
'fe1b1', 'e1b1', # fe1b1 branch
'db1', # fe1b1 and e2b1 branches terminate at db1
'cb1', 'b1', # e2b1 branch continued....might be nicer
# if this was before the e2b2 branch...
'a3', # e2b1 and e2b2 branches terminate at a3
'a2', 'a1' # finish out
] # noqa
)
def test_three_branches_end_multiple_bases(self):
# in this case, both "a3" and "db1" are stop points
self._assert_iteration(
["merge", "fe1b1"], ["cb1", "cb2"],
[
'merge',
'e2b1',
'e2b2', 'db2', 'cb2',
'fe1b1', 'e1b1',
'db1',
'cb1'
]
)
def test_three_branches_end_multiple_bases_exclusive(self):
self._assert_iteration(
["merge", "fe1b1"], ["cb1", "cb2"],
[
'merge',
'e2b1',
'e2b2', 'db2',
'fe1b1', 'e1b1',
'db1',
],
inclusive=False
)
def test_detect_invalid_head_selection(self):
# db1 is an ancestor of fe1b1
assert_raises_message(
RevisionError,
"Requested revision fe1b1 overlaps "
"with other requested revisions",
list,
self.map._iterate_revisions(["db1", "b2", "fe1b1"], ())
)
def test_three_branches_end_multiple_bases_exclusive_blank(self):
self._assert_iteration(
["e2b1", "b2", "fe1b1"], (),
[
'e2b1',
'b2',
'fe1b1', 'e1b1',
'db1', 'cb1', 'b1', 'a3', 'a2', 'a1'
],
inclusive=False
)
def test_iterate_to_symbolic_base(self):
self._assert_iteration(
["fe1b1"], "base",
['fe1b1', 'e1b1', 'db1', 'cb1', 'b1', 'a3', 'a2', 'a1'],
inclusive=False
)
def test_ancestor_nodes(self):
merge = self.map.get_revision("merge")
eq_(
set(
rev.revision
for rev in self.map._get_ancestor_nodes([merge], check=True)
),
set(['a1', 'e2b2', 'e2b1', 'cb2', 'merge',
'a3', 'a2', 'b1', 'b2', 'db1', 'db2', 'cb1'])
)