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


Python Weave.get_lines方法代碼示例

本文整理匯總了Python中bzrlib.weave.Weave.get_lines方法的典型用法代碼示例。如果您正苦於以下問題:Python Weave.get_lines方法的具體用法?Python Weave.get_lines怎麽用?Python Weave.get_lines使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bzrlib.weave.Weave的用法示例。


在下文中一共展示了Weave.get_lines方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: runTest

# 需要導入模塊: from bzrlib.weave import Weave [as 別名]
# 或者: from bzrlib.weave.Weave import get_lines [as 別名]
    def runTest(self):
        k = Weave()

        k._parents = [frozenset(),
                frozenset([0]),
                ]
        k._weave = [('{', 0),
                'first line',
                ('[', 1),
                'line to be deleted',
                (']', 1),
                ('{', 1),
                'replacement line',                
                ('}', 1),
                'last line',
                ('}', 0),
                ]
        k._sha1s = [sha_string('first lineline to be deletedlast line')
                  , sha_string('first linereplacement linelast line')]

        self.assertEqual(k.get_lines(0),
                         ['first line',
                          'line to be deleted',
                          'last line',
                          ])

        self.assertEqual(k.get_lines(1),
                         ['first line',
                          'replacement line',
                          'last line',
                          ])
開發者ID:c0ns0le,項目名稱:cygwin,代碼行數:33,代碼來源:test_weave.py

示例2: test_multi_line_merge

# 需要導入模塊: from bzrlib.weave import Weave [as 別名]
# 或者: from bzrlib.weave.Weave import get_lines [as 別名]
    def test_multi_line_merge(self):
        rawtexts = [
            """A Book of Verses underneath the Bough,
            A Jug of Wine, a Loaf of Bread, -- and Thou
            Beside me singing in the Wilderness --
            Oh, Wilderness were Paradise enow!""",
            
            """A Book of Verses underneath the Bough,
            A Jug of Wine, a Loaf of Bread, -- and Thou
            Beside me singing in the Wilderness --
            Oh, Wilderness were Paradise now!""",

            """A Book of poems underneath the tree,
            A Jug of Wine, a Loaf of Bread,
            and Thou
            Beside me singing in the Wilderness --
            Oh, Wilderness were Paradise now!

            -- O. Khayyam""",

            """A Book of Verses underneath the Bough,
            A Jug of Wine, a Loaf of Bread,
            and Thou
            Beside me singing in the Wilderness --
            Oh, Wilderness were Paradise now!""",
            ]
        texts = [[l.strip() for l in t.split('\n')] for t in rawtexts]

        k = Weave()
        parents = set()
        i = 0
        for t in texts:
            ver = k.add_lines('text%d' % i,
                        list(parents), t)
            parents.add('text%d' % i)
            i += 1

        self.log("k._weave=" + pformat(k._weave))

        for i, t in enumerate(texts):
            self.assertEqual(k.get_lines(i), t)

        self.check_read_write(k)
開發者ID:c0ns0le,項目名稱:cygwin,代碼行數:45,代碼來源:test_weave.py

示例3: test_allow_reserved_true

# 需要導入模塊: from bzrlib.weave import Weave [as 別名]
# 或者: from bzrlib.weave.Weave import get_lines [as 別名]
 def test_allow_reserved_true(self):
     w = Weave('name', allow_reserved=True)
     w.add_lines('name:', [], TEXT_1)
     self.assertEqual(TEXT_1, w.get_lines('name:'))
開發者ID:c0ns0le,項目名稱:cygwin,代碼行數:6,代碼來源:test_weave.py


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