当前位置: 首页>>代码示例>>Python>>正文


Python Timeline.get_merged_timelines方法代码示例

本文整理汇总了Python中timeline.Timeline.get_merged_timelines方法的典型用法代码示例。如果您正苦于以下问题:Python Timeline.get_merged_timelines方法的具体用法?Python Timeline.get_merged_timelines怎么用?Python Timeline.get_merged_timelines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在timeline.Timeline的用法示例。


在下文中一共展示了Timeline.get_merged_timelines方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_merged_timeline__single_timeline

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timeline__single_timeline(self):
        """Verify merged timeline of exactly one partial timeline.
        """
        partial_timeline = ['one', 'two', 'three', 'four']
        timeline = Timeline(partial_timelines=[partial_timeline])

        # Verify get_merged_timelines return value
        merged_timelines = timeline.get_merged_timelines()
        self.assertEqual([partial_timeline], merged_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:11,代码来源:test_timeline.py

示例2: test_get_merged_timelines__full_merge__interleaved

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timelines__full_merge__interleaved(self):
        """Verify that unambiguous interleaved timelines merge correctly.
        """
        partial_timelines = [['two', 'three', 'seven'],
                             ['three', 'four', 'five', 'seven']]
        timeline = Timeline(partial_timelines=partial_timelines)

        merged_timelines = timeline.get_merged_timelines()
        self.assertEqual([['two', 'three', 'four', 'five', 'seven']],
                         merged_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:12,代码来源:test_timeline.py

示例3: test_get_merged_timelines__full_merge__start_and_end_overlap

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timelines__full_merge__start_and_end_overlap(self):
        """Verify that unambiguous overlapping timelines merge correctly.
        """
        partial_timelines = [['two', 'three', 'six'],
                             ['six', 'seven'],
                             ['one', 'two']]
        timeline = Timeline(partial_timelines=partial_timelines)

        merged_timelines = timeline.get_merged_timelines()
        self.assertEqual([['one', 'two', 'three', 'six', 'seven']],
                         merged_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:13,代码来源:test_timeline.py

示例4: test_get_merged_timelines__full_merge__shooting_example

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timelines__full_merge__shooting_example(self):
        """Verify that full merge is possible for shooting example.
        """
        partial_timelines = [
            ['shouting', 'fight', 'fleeing'],
            ['fight', 'gunshot', 'panic', 'fleeing'],
            ['anger', 'shouting']]
        timeline = Timeline(partial_timelines=partial_timelines)

        merged_timelines = timeline.get_merged_timelines()
        self.assertEqual([['anger', 'shouting', 'fight', 'gunshot', 'panic', 'fleeing']],
                         merged_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:14,代码来源:test_timeline.py

示例5: test_get_merged_timelines__no_merge__scandal_example

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timelines__no_merge__scandal_example(self):
        """Verify that no merge is possible for scandal example.
        """
        partial_timelines = [
            ['argument', 'coverup', 'pointing'],
            ['press brief', 'scandal', 'pointing'],
            ['argument', 'bribe']]
        timeline = Timeline(partial_timelines=partial_timelines)

        merged_timelines = timeline.get_merged_timelines()
        expected_timelines = partial_timelines
        self.assertEqual(len(expected_timelines), len(merged_timelines))
        for merged_timeline in merged_timelines:
            self.assertTrue(merged_timeline in expected_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:16,代码来源:test_timeline.py

示例6: test_get_merged_timelines__partial_merge

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timelines__partial_merge(self):
        """Verify that ambiguous partial timelines are merged as far as possible.
        """
        partial_timelines = [['two', 'three', 'four', 'seven', 'eight'],
                             ['one', 'two', 'five', 'six', 'seven']]
        timeline = Timeline(partial_timelines=partial_timelines)

        merged_timelines = timeline.get_merged_timelines()
        expected_timelines = [
            ['one', 'two', 'three', 'four', 'seven', 'eight'],
            ['one', 'two', 'five', 'six', 'seven', 'eight']]
        self.assertEqual(len(expected_timelines), len(merged_timelines))
        for merged_timeline in merged_timelines:
            self.assertTrue(merged_timeline in expected_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:16,代码来源:test_timeline.py

示例7: test_get_merged_timelines__partial_merge__foiled_mugging_example

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timelines__partial_merge__foiled_mugging_example(self):
        """Verify that partial merge is possible for foiled_mugging example.
        """
        partial_timelines = [
            ['shadowy figure', 'demands', 'scream', 'siren'],
            ['shadowy figure', 'pointed gun', 'scream']]
        timeline = Timeline(partial_timelines=partial_timelines)

        merged_timelines = timeline.get_merged_timelines()
        expected_timelines = [
            ['shadowy figure', 'demands', 'scream', 'siren'],
            ['shadowy figure', 'pointed gun', 'scream', 'siren']]
        self.assertEqual(len(expected_timelines), len(merged_timelines))
        for merged_timeline in merged_timelines:
            self.assertTrue(merged_timeline in expected_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:17,代码来源:test_timeline.py

示例8: test_get_merged_timelines__partial_merge__arson_example

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timelines__partial_merge__arson_example(self):
        """Verify that partial merge is possible for arson example.
        """
        partial_timelines = [
            ['pouring gas', 'laughing', 'lighting match', 'fire'],
            ['buying gas', 'pouring gas', 'crying', 'fire', 'smoke']]
        timeline = Timeline(partial_timelines=partial_timelines)

        merged_timelines = timeline.get_merged_timelines()
        expected_timelines = [
            ['buying gas', 'pouring gas', 'crying', 'fire', 'smoke'],
            ['buying gas', 'pouring gas', 'laughing', 'lighting match', 'fire', 'smoke']]
        self.assertEqual(len(expected_timelines), len(merged_timelines))
        for merged_timeline in merged_timelines:
            self.assertTrue(merged_timeline in expected_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:17,代码来源:test_timeline.py

示例9: test_get_merged_timelines__multiple_partial_merge

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
    def test_get_merged_timelines__multiple_partial_merge(self):
        """Verify that ambiguous partial timelines are merged in multiple places.

        Note that generating four timelines may not be the desired behavior. Rather, we 
        would like two timelines with merged fronts, middles, and ends, one timeline with 
        the divergent sections of the first partial timeline and the other with the
        divergent sections of the second partial timeline.
        """
        partial_timelines = [['two', 'three', 'four', 'six', 'seven', 'eight', 'nine', 'eleven'],
                             ['one', 'two', 'five', 'six', 'seven', 'ten', 'eleven', 'twelve']]
        timeline = Timeline(partial_timelines=partial_timelines)

        merged_timelines = timeline.get_merged_timelines()
        expected_timelines = [
            ['one', 'two', 'three', 'four', 'six', 'seven', 'eight', 'nine', 'eleven', 'twelve'],
            ['one', 'two', 'three', 'four', 'six', 'seven', 'ten', 'eleven', 'twelve'],
            ['one', 'two', 'five', 'six', 'seven', 'eight', 'nine', 'eleven', 'twelve'],
            ['one', 'two', 'five', 'six', 'seven', 'ten', 'eleven', 'twelve']]
        self.assertEqual(len(expected_timelines), len(merged_timelines))
        for merged_timeline in merged_timelines:
            self.assertTrue(merged_timeline in expected_timelines)
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:23,代码来源:test_timeline.py

示例10: test_get_merged_timeline__none

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import get_merged_timelines [as 别名]
 def test_get_merged_timeline__none(self):
     """Verify merged timeline of nothing.
     """
     timeline = Timeline()
     self.assertEqual([[]], timeline.get_merged_timelines())
开发者ID:jpowerwa,项目名称:coding-examples,代码行数:7,代码来源:test_timeline.py


注:本文中的timeline.Timeline.get_merged_timelines方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。