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


Python TracBugParser.set_bug_csv_data方法代码示例

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


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

示例1: test_get_opened_date_with_timeline_class

# 需要导入模块: from bugimporters.trac import TracBugParser [as 别名]
# 或者: from bugimporters.trac.TracBugParser import set_bug_csv_data [as 别名]
    def test_get_opened_date_with_timeline_class(self):
        '''This test case is for input that has the reported date of the bug inside 
        an a tag with class "timeline" and the div with "date" class is missing''' 
        tbp = TracBugParser(
                bug_url='https://projects.forum.nokia.com/ndg/ticket/92')

        # Add data to avoid the network hit
        # (This is a file you can get by calling 'wget' on the above ticket URL.)
        # (You might have to add --no-check-certificate to override the certificate common name error)
        cached_html_filename = os.path.join(HERE, 'sample-data',
                'ndg-ticket-92')
        tbp.set_bug_html_data(unicode(
            open(cached_html_filename).read(), 'utf-8'))

        # This CSV data comes from visiting
        # https://projects.forum.nokia.com/ndg/ticket/92 and clicking
        # "Comma-delimited text" at the bottom.
        tbp.set_bug_csv_data(open(os.path.join(HERE, 'sample-data',
                'ndg-ticket-92.csv')).read())

        # Provide a fake "tracker model", which is a little bit of data that
        # corresponds to information about the open source project in question
        # and how its bug tracker is configured.
        tm = TrackerModel()

        # Now, actually look at the data returned by the BugParser object
        # and verify its output through assertions.
        returned_data = tbp.get_parsed_data_dict(tm)
        assert returned_data['title'] == 'Enhanced GPS setting'
        assert returned_data['date_reported']
开发者ID:Aaron1011,项目名称:oh-bugimporters,代码行数:32,代码来源:test_trac.py

示例2: test_create_bug_with_link_in_reported_by_field

# 需要导入模块: from bugimporters.trac import TracBugParser [as 别名]
# 或者: from bugimporters.trac.TracBugParser import set_bug_csv_data [as 别名]
    def test_create_bug_with_link_in_reported_by_field(self):
        tbp = TracBugParser('https://code.djangoproject.com/query?id=18937')

        cached_csv_filename = os.path.join(HERE, 'sample-data', 'django-trac-18937.csv')
        tbp.set_bug_csv_data(unicode(
            open(cached_csv_filename).read(), 'utf-8'))

        cached_html_filename = os.path.join(HERE, 'sample-data', 'django-trac-18937.html')
        tbp.set_bug_html_data(unicode(
            open(cached_html_filename).read(), 'utf-8'))

        got = tbp.get_parsed_data_dict(self.tm4)
        del got['last_polled']

        wanted = {
            '_project_name': 'Tango',
            'as_appears_in_distribution': '',
            'canonical_bug_link': 'https://code.djangoproject.com/query?id=18937',
            'concerns_just_documentation': False,
            'date_reported': printable_datetime(
                datetime.datetime(2012, 9, 10, 3, 17, 54)),
            'description': u'Add a PKG-INFO file as fitting with [http://www.python.org/dev/peps/pep-0345/ PEP 345].\r\rSee [http://blog.ziade.org/2012/09/10/dear-django-help-python-packaging/ this blog post] for reference.\r\rSeems to me we can add this metadata file without too much difficulty and make new packaging happy :D\r\r',
            'good_for_newcomers': False,
            'importance': '',
            'last_touched': printable_datetime(
                datetime.datetime(2012, 9, 10, 3, 27, 13)),
            'looks_closed': False,
            'people_involved': 3,
            'status': 'new',
            'submitter_realname': '',
            'submitter_username': 'mjtamlyn',
            'title': 'Use modern Python packaging metadata standard (1.2, PEP 345)',
        }
        self.assertEqual(wanted, got)
开发者ID:vu2srk,项目名称:oh-bugimporters,代码行数:36,代码来源:test_trac.py

示例3: test_bug_with_difficulty_easy_is_bitesize

# 需要导入模块: from bugimporters.trac import TracBugParser [as 别名]
# 或者: from bugimporters.trac.TracBugParser import set_bug_csv_data [as 别名]
    def test_bug_with_difficulty_easy_is_bitesize(self):
        tbp = TracBugParser(
                bug_url='http://hackage.haskell.org/trac/ghc/ticket/4268')

        cached_html_filename = os.path.join(HERE, 'sample-data',
                'ghc-trac-4268.html')
        tbp.set_bug_html_data(unicode(
            open(cached_html_filename).read(), 'utf-8'))

        cached_csv_filename = os.path.join(HERE, 'sample-data',
                'ghc-trac-4268.csv')
        tbp.set_bug_csv_data(open(cached_csv_filename).read())

        tm = HaskellTrackerModel()

        returned_data = tbp.get_parsed_data_dict(tm)
        assert returned_data['good_for_newcomers'], '''The bug is considered
开发者ID:soonick,项目名称:oh-bugimporters,代码行数:19,代码来源:test_trac.py

示例4: test_bug_parser

# 需要导入模块: from bugimporters.trac import TracBugParser [as 别名]
# 或者: from bugimporters.trac.TracBugParser import set_bug_csv_data [as 别名]
    def test_bug_parser(self):
        ### As an aside:
        # TracBugParser is amusing, as it pulls data from two different sources.
        # 1. Data pulled from the Trac API, which is stored for the parser's
        #    benefit in csv_data.
        # 2. Data that must be scraped from the Trac web app, since the API
        #    doesn't expose everything. This gets stored in html_data.

        # In this test, we provide versions of that data that we downloaded
        # in the past so that we can make this test run fast and reliably.
        # By providing the data here, we permit the test to run without
        # accessing the network.

        # Create a new TracBugParser that is aware of the URL it refers to
        tbp = TracBugParser(
            bug_url='http://twistedmatrix.com/trac/ticket/4298')

        # Add data to avoid the network hit
        # (This is a file you can get by calling 'wget' on the above ticket URL.)
        cached_html_filename = os.path.join(
            HERE, 'sample-data', 'twisted-trac-4298-on-2010-04-02.html')
        tbp.set_bug_html_data(
            unicode(open(cached_html_filename).read(), 'utf-8'))

        # This CSV data comes from visiting
        # http://twistedmatrix.com/trac/ticket/4298 and clicking
        # "Comma-delimited text" at the bottom.
        tbp.set_bug_csv_data(
            open(
                os.path.join(HERE, 'sample-data',
                             'twisted-trac-4298-csv-export')).read())

        # Provide a fake "tracker model", which is a little bit of data that
        # corresponds to information about the open source project in question
        # and how its bug tracker is configured.
        tm = TrackerModel()

        # Now, actually look at the data returned by the BugParser object
        # and verify its output through assertions.
        returned_data = tbp.get_parsed_data_dict(tm)
        assert returned_data['title'] == 'Deprecate twisted.persisted.journal'
        assert returned_data['good_for_newcomers']
开发者ID:andrefreitas,项目名称:oh-bugimporters,代码行数:44,代码来源:test_trac.py


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