本文整理汇总了Python中alembic.script.revision.RevisionMap类的典型用法代码示例。如果您正苦于以下问题:Python RevisionMap类的具体用法?Python RevisionMap怎么用?Python RevisionMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RevisionMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_invalid_datatype
def test_invalid_datatype(self):
map_ = RevisionMap(
lambda: [
Revision("a", ()),
Revision("b", ("a",)),
Revision("c", ("b",)),
]
)
assert_raises_message(
RevisionError,
"revision identifier b'12345' is not a string; "
"ensure database driver settings are correct",
map_.get_revisions, b'12345'
)
assert_raises_message(
RevisionError,
"revision identifier b'12345' is not a string; "
"ensure database driver settings are correct",
map_.get_revision, b'12345'
)
assert_raises_message(
RevisionError,
r"revision identifier \(b'12345',\) is not a string; "
"ensure database driver settings are correct",
map_.get_revision, (b'12345', )
)
map_.get_revision(("a", ))
map_.get_revision("a")
示例2: test_get_revision_head_single
def test_get_revision_head_single(self):
map_ = RevisionMap(
lambda: [
Revision("a", ()),
Revision("b", ("a",)),
Revision("c", ("b",)),
]
)
eq_(map_.get_revision("head"), map_._revision_map["c"])
示例3: test_get_revision_base_single
def test_get_revision_base_single(self):
map_ = RevisionMap(
lambda: [
Revision("a", ()),
Revision("b", ("a",)),
Revision("c", ("b",)),
]
)
eq_(map_.get_revision("base"), None)
示例4: test_add_revision_one_head
def test_add_revision_one_head(self):
map_ = RevisionMap(
lambda: [
Revision("a", ()),
Revision("b", ("a",)),
Revision("c", ("b",)),
]
)
eq_(map_.heads, ("c",))
map_.add_revision(Revision("d", ("c",)))
eq_(map_.heads, ("d",))
示例5: test_add_revision_one_head
def test_add_revision_one_head(self):
map_ = RevisionMap(
lambda: [
Revision('a', ()),
Revision('b', ('a',)),
Revision('c', ('b',)),
]
)
eq_(map_.heads, ('c', ))
map_.add_revision(Revision('d', ('c', )))
eq_(map_.heads, ('d', ))
示例6: test_add_revision_two_head
def test_add_revision_two_head(self):
map_ = RevisionMap(
lambda: [
Revision("a", ()),
Revision("b", ("a",)),
Revision("c1", ("b",)),
Revision("c2", ("b",)),
]
)
eq_(map_.heads, ("c1", "c2"))
map_.add_revision(Revision("d1", ("c1",)))
eq_(map_.heads, ("c2", "d1"))
示例7: test_add_revision_two_head
def test_add_revision_two_head(self):
map_ = RevisionMap(
lambda: [
Revision('a', ()),
Revision('b', ('a',)),
Revision('c1', ('b',)),
Revision('c2', ('b',)),
]
)
eq_(map_.heads, ('c1', 'c2'))
map_.add_revision(Revision('d1', ('c1', )))
eq_(map_.heads, ('c2', 'd1'))
示例8: test_iterate_tolerates_dupe_targets
def test_iterate_tolerates_dupe_targets(self):
map_ = RevisionMap(
lambda: [
Revision("a", ()),
Revision("b", ("a",)),
Revision("c", ("b",)),
]
)
eq_(
[r.revision for r in map_._iterate_revisions(("c", "c"), "a")],
["c", "b", "a"],
)
示例9: test_filter_for_lineage_labeled_head_across_merge
def test_filter_for_lineage_labeled_head_across_merge(self):
def fn():
return [
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])
示例10: test_iterate_tolerates_dupe_targets
def test_iterate_tolerates_dupe_targets(self):
map_ = RevisionMap(
lambda: [
Revision('a', ()),
Revision('b', ('a',)),
Revision('c', ('b',)),
]
)
eq_(
[
r.revision for r in
map_._iterate_revisions(('c', 'c'), 'a')
],
['c', 'b', 'a']
)
示例11: setUp
def setUp(self):
"""
Structure::
base1 -----> a1a -> b1a
+----> a1b -> b1b
|
+-----------+
|
v
base3 -> a3 -> b3
^
|
+-----------+
|
base2 -> a2 -> b2 -> c2 -> d2
"""
self.map = RevisionMap(
lambda: [
Revision("base1", (), branch_labels="b_1"),
Revision("a1a", ("base1",)),
Revision("a1b", ("base1",)),
Revision("b1a", ("a1a",)),
Revision("b1b", ("a1b",), dependencies="a3"),
Revision("base2", (), branch_labels="b_2"),
Revision("a2", ("base2",)),
Revision("b2", ("a2",)),
Revision("c2", ("b2",), dependencies="a3"),
Revision("d2", ("c2",)),
Revision("base3", (), branch_labels="b_3"),
Revision("a3", ("base3",)),
Revision("b3", ("a3",)),
]
)
示例12: test_filter_for_lineage_labeled_head_across_merge
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]
)
示例13: setUp
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',)),
])
示例14: DepResolutionFailedTest
class DepResolutionFailedTest(DownIterateTest):
def setUp(self):
self.map = RevisionMap(
lambda: [
Revision("base1", ()),
Revision("a1", "base1"),
Revision("a2", "base1"),
Revision("b1", "a1"),
Revision("c1", "b1"),
]
)
# intentionally make a broken map
self.map._revision_map["fake"] = self.map._revision_map["a2"]
self.map._revision_map["b1"].dependencies = "fake"
self.map._revision_map["b1"]._resolved_dependencies = ("fake",)
def test_failure_message(self):
iter_ = self.map.iterate_revisions("c1", "base1")
assert_raises_message(
RevisionError, "Dependency resolution failed;", list, iter_
)
示例15: DepResolutionFailedTest
class DepResolutionFailedTest(DownIterateTest):
def setUp(self):
self.map = RevisionMap(
lambda: [
Revision('base1', ()),
Revision('a1', 'base1'),
Revision('a2', 'base1'),
Revision('b1', 'a1'),
Revision('c1', 'b1'),
]
)
# intentionally make a broken map
self.map._revision_map['fake'] = self.map._revision_map['a2']
self.map._revision_map['b1'].dependencies = 'fake'
self.map._revision_map['b1']._resolved_dependencies = ('fake', )
def test_failure_message(self):
iter_ = self.map.iterate_revisions("c1", "base1")
assert_raises_message(
RevisionError,
"Dependency resolution failed;",
list, iter_
)