当前位置: 首页>>代码示例>>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;未经允许,请勿转载。