コード例 #1
0
 def test_message_with_tuple(self):
     error = ScriptError('', ('my', 'command'), -1, 'My output.',
                         '/Users/username/blah')
     self.assertEqual(
         error.message_with_output(),
         'Failed to run "(\'my\', \'command\')" exit_code: -1 cwd: /Users/username/blah\n\noutput: My output.'
     )
コード例 #2
0
 def test_message_with_output(self):
     error = ScriptError('My custom message!', '', -1)
     self.assertEqual(error.message_with_output(), 'My custom message!')
     error = ScriptError('My custom message!', '', -1, 'My output.')
     self.assertEqual(error.message_with_output(),
                      'My custom message!\n\noutput: My output.')
     error = ScriptError('', 'my_command!', -1, 'My output.',
                         '/Users/username/blah')
     self.assertEqual(
         error.message_with_output(),
         'Failed to run "\'my_command!\'" exit_code: -1 cwd: /Users/username/blah\n\noutput: My output.'
     )
     error = ScriptError('', 'my_command!', -1, 'ab' + '1' * 499)
     self.assertEqual(
         error.message_with_output(),
         'Failed to run "\'my_command!\'" exit_code: -1\n\noutput: Last 500 characters of output:\nb'
         + '1' * 499)