testing/unexpected_passes_common/result_output_unittest.py
def testLengthLimit(self):
    """Tests that only a certain number of characters are allowed per line."""
    urls = [
        'crbug.com/averylongprojectthatwillgooverthelinelength/1',
        'crbug.com/averylongprojectthatwillgooverthelinelength/2',
    ]
    result_output._OutputUrlsForClDescription(urls, [], self._file_handle)
    self._file_handle.close()
    with open(self._filepath) as f:
      self.assertEqual(f.read(),
                       ('Affected bugs for CL description:\n'
                        'Bug: averylongprojectthatwillgooverthelinelength:1\n'
                        'Bug: averylongprojectthatwillgooverthelinelength:2\n'))

    project_name = (result_output.MAX_CHARACTERS_PER_CL_LINE - len('Bug: ') -
                    len(':1, 2')) * 'a'
    urls = [
        'crbug.com/%s/1' % project_name,
        'crbug.com/2',
    ]
    with open(self._filepath, 'w') as f:
      result_output._OutputUrlsForClDescription(urls, [], f)
    with open(self._filepath) as f:
      self.assertEqual(f.read(), ('Affected bugs for CL description:\n'
                                  'Bug: 2, %s:1\n' % project_name))

    project_name += 'a'
    urls = [
        'crbug.com/%s/1' % project_name,
        'crbug.com/2',
    ]
    with open(self._filepath, 'w') as f:
      result_output._OutputUrlsForClDescription(urls, [], f)
    with open(self._filepath) as f:
      self.assertEqual(f.read(), ('Affected bugs for CL description:\n'
                                  'Bug: 2\nBug: %s:1\n' % project_name))
Tests that only a certain number of characters are allowed per line.
Tests that only a certain number of characters are allowed per line.
Tests that only a certain number of characters are allowed per line .
def testLengthLimit(self):
    urls = [
        'crbug.com/averylongprojectthatwillgooverthelinelength/1',
        'crbug.com/averylongprojectthatwillgooverthelinelength/2',
    ]
    result_output._OutputUrlsForClDescription(urls, [], self._file_handle)
    self._file_handle.close()
    with open(self._filepath) as f:
      self.assertEqual(f.read(),
                       ('Affected bugs for CL description:\n'
                        'Bug: averylongprojectthatwillgooverthelinelength:1\n'
                        'Bug: averylongprojectthatwillgooverthelinelength:2\n'))
    project_name = (result_output.MAX_CHARACTERS_PER_CL_LINE - len('Bug: ') -
                    len(':1, 2')) * 'a'
    urls = [
        'crbug.com/%s/1' % project_name,
        'crbug.com/2',
    ]
    with open(self._filepath, 'w') as f:
      result_output._OutputUrlsForClDescription(urls, [], f)
    with open(self._filepath) as f:
      self.assertEqual(f.read(), ('Affected bugs for CL description:\n'
                                  'Bug: 2, %s:1\n' % project_name))
    project_name += 'a'
    urls = [
        'crbug.com/%s/1' % project_name,
        'crbug.com/2',
    ]
    with open(self._filepath, 'w') as f:
      result_output._OutputUrlsForClDescription(urls, [], f)
    with open(self._filepath) as f:
      self.assertEqual(f.read(), ('Affected bugs for CL description:\n'
                                  'Bug: 2\nBug: %s:1\n' % project_name))
def testLengthLimit ( self ) : urls = [ 'crbug.com/averylongprojectthatwillgooverthelinelength/1' , 'crbug.com/averylongprojectthatwillgooverthelinelength/2' , ] result_output . _OutputUrlsForClDescription ( urls , [ ] , self . _file_handle ) self . _file_handle . close ( ) with open ( self . _filepath ) as f : self . assertEqual ( f . read ( ) , ( 'Affected bugs for CL description:\n' 'Bug: averylongprojectthatwillgooverthelinelength:1\n' 'Bug: averylongprojectthatwillgooverthelinelength:2\n' ) ) project_name = ( result_output . MAX_CHARACTERS_PER_CL_LINE - len ( 'Bug: ' ) - len ( ':1, 2' ) ) * 'a' urls = [ 'crbug.com/%s/1' % project_name , 'crbug.com/2' , ] with open ( self . _filepath , 'w' ) as f : result_output . _OutputUrlsForClDescription ( urls , [ ] , f ) with open ( self . _filepath ) as f : self . assertEqual ( f . read ( ) , ( 'Affected bugs for CL description:\n' 'Bug: 2, %s:1\n' % project_name ) ) project_name += 'a' urls = [ 'crbug.com/%s/1' % project_name , 'crbug.com/2' , ] with open ( self . _filepath , 'w' ) as f : result_output . _OutputUrlsForClDescription ( urls , [ ] , f ) with open ( self . _filepath ) as f : self . assertEqual ( f . read ( ) , ( 'Affected bugs for CL description:\n' 'Bug: 2\nBug: %s:1\n' % project_name ) )
Tests that only a certain number of characters are allowed per line.
Tests that only a certain number of characters are allowed per line .
"""Tests that only a certain number of characters are allowed per line."""
self