當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。