def testSplitPatternLines_OnePattern(self):
     # The SplitPatternLines function returns a list of patterns.
     self.assertEqual([], edit_config_handler._SplitPatternLines(''))
     self.assertEqual(['A/b/c'],
                      edit_config_handler._SplitPatternLines('A/b/c'))
     self.assertEqual(['A/b/c'],
                      edit_config_handler._SplitPatternLines('A/b/c\n\n'))
 def testSplitPatternLines_SortsPatterns(self):
     # Re-ordering and extra newlines are ignored in patterns input.
     self.assertEqual(
         ['A/b/c/d', 'E/f/g/h'],
         edit_config_handler._SplitPatternLines('A/b/c/d\nE/f/g/h'))
     self.assertEqual(
         ['A/b/c/d', 'E/f/g/h'],
         edit_config_handler._SplitPatternLines('E/f/g/h\nA/b/c/d'))
     self.assertEqual(
         ['A/b/c/d', 'E/f/g/h'],
         edit_config_handler._SplitPatternLines('A/b/c/d\n\nE/f/g/h\n'))
 def testSplitPatternLines_SortsPatterns(self):
   # Re-ordering and extra newlines are ignored in patterns input.
   self.assertEqual(
       ['A/b/c/d', 'E/f/g/h'],
       edit_config_handler._SplitPatternLines('A/b/c/d\nE/f/g/h'))
   self.assertEqual(
       ['A/b/c/d', 'E/f/g/h'],
       edit_config_handler._SplitPatternLines('E/f/g/h\nA/b/c/d'))
   self.assertEqual(
       ['A/b/c/d', 'E/f/g/h'],
       edit_config_handler._SplitPatternLines('A/b/c/d\n\nE/f/g/h\n'))
 def testSplitPatternLines_HasBrackets_RaisesError(self):
     # Strings with brackets in them cannot be valid test paths.
     with self.assertRaises(request_handler.InvalidInputError):
         edit_config_handler._SplitPatternLines('A/b/c/d/[e]')
 def testSplitPatternLines_NoSlashes_RaisesError(self):
     # A valid test path must contain a master, bot, and test part.
     with self.assertRaises(request_handler.InvalidInputError):
         edit_config_handler._SplitPatternLines('invalid')
 def testSplitPatternLines_HasBrackets_RaisesError(self):
   # Strings with brackets in them cannot be valid test paths.
   with self.assertRaises(request_handler.InvalidInputError):
     edit_config_handler._SplitPatternLines('A/b/c/d/[e]')
 def testSplitPatternLines_NoSlashes_RaisesError(self):
   # A valid test path must contain a master, bot, and test part.
   with self.assertRaises(request_handler.InvalidInputError):
     edit_config_handler._SplitPatternLines('invalid')
 def testSplitPatternLines_OnePattern(self):
   # The SplitPatternLines function returns a list of patterns.
   self.assertEqual([], edit_config_handler._SplitPatternLines(''))
   self.assertEqual(['A/b/c'], edit_config_handler._SplitPatternLines('A/b/c'))
   self.assertEqual(
       ['A/b/c'], edit_config_handler._SplitPatternLines('A/b/c\n\n'))