當前位置: 首頁>>代碼示例>>Python>>正文


Python revision.RevisionMap類代碼示例

本文整理匯總了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")
開發者ID:zzzeek,項目名稱:alembic,代碼行數:31,代碼來源:test_revision.py

示例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"])
開發者ID:zzzeek,項目名稱:alembic,代碼行數:9,代碼來源:test_revision.py

示例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)
開發者ID:zzzeek,項目名稱:alembic,代碼行數:9,代碼來源:test_revision.py

示例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",))
開發者ID:zzzeek,項目名稱:alembic,代碼行數:12,代碼來源:test_revision.py

示例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', ))
開發者ID:RazerM,項目名稱:alembic,代碼行數:12,代碼來源:test_revision.py

示例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"))
開發者ID:zzzeek,項目名稱:alembic,代碼行數:13,代碼來源:test_revision.py

示例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'))
開發者ID:RazerM,項目名稱:alembic,代碼行數:13,代碼來源:test_revision.py

示例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"],
        )
開發者ID:zzzeek,項目名稱:alembic,代碼行數:13,代碼來源:test_revision.py

示例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])
開發者ID:zzzeek,項目名稱:alembic,代碼行數:15,代碼來源:test_revision.py

示例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']
        )
開發者ID:RazerM,項目名稱:alembic,代碼行數:16,代碼來源:test_revision.py

示例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",)),
            ]
        )
開發者ID:zzzeek,項目名稱:alembic,代碼行數:35,代碼來源:test_revision.py

示例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]
        )
開發者ID:RazerM,項目名稱:alembic,代碼行數:17,代碼來源:test_revision.py

示例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',)),
     ])
開發者ID:RazerM,項目名稱:alembic,代碼行數:11,代碼來源:test_revision.py

示例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_
        )
開發者ID:zzzeek,項目名稱:alembic,代碼行數:21,代碼來源:test_revision.py

示例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_
        )
開發者ID:RazerM,項目名稱:alembic,代碼行數:23,代碼來源:test_revision.py


注:本文中的alembic.script.revision.RevisionMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。