def _testParseCmdLine(self, command_line, expected_flags): # Start with a command line, check that flags are parsed as expected. # pylint: disable=protected-access flags = flag_changer._ParseFlags(command_line) self.assertItemsEqual(flags, expected_flags) # Check that flags survive a round-trip. # Note: Although new_command_line and command_line may not match, they # should describe the same set of flags. new_command_line = flag_changer._SerializeFlags(flags) new_flags = flag_changer._ParseFlags(new_command_line) self.assertItemsEqual(new_flags, expected_flags)
def _testQuoteFlag(self, flag, expected_quoted_flag): # Start with an unquoted flag, check that it's quoted as expected. # pylint: disable=protected-access quoted_flag = flag_changer._QuoteFlag(flag) self.assertEqual(quoted_flag, expected_quoted_flag) # Check that it survives a round-trip. parsed_flags = flag_changer._ParseFlags('_ %s' % quoted_flag) self.assertEqual(len(parsed_flags), 1) self.assertEqual(flag, parsed_flags[0])