def testFindConfigSpecified(self):
        """Tests whether config is specified on the command line."""

        config_flag = config_flags._ConfigFlag(parser=flags.ArgumentParser(),
                                               serializer=None,
                                               name='test_config',
                                               default='defaultconfig.py',
                                               help_string='')
        self.assertEqual(config_flag._FindConfigSpecified(['']), -1)

        argv_length = 20
        for i in range(argv_length):
            # Generate list of '--test_config.i=0' args.
            argv = [
                '--test_config.{}=0'.format(arg) for arg in range(argv_length)
            ]
            self.assertEqual(config_flag._FindConfigSpecified(argv), -1)

            # Override i-th arg with something specifying the value of 'test_config'.
            # After doing this, _FindConfigSpecified should return the value of i.
            argv[i] = '--test_config'
            self.assertEqual(config_flag._FindConfigSpecified(argv), i)
            argv[i] = '--test_config=config.py'
            self.assertEqual(config_flag._FindConfigSpecified(argv), i)
            argv[i] = '-test_config'
            self.assertEqual(config_flag._FindConfigSpecified(argv), i)
            argv[i] = '-test_config=config.py'
            self.assertEqual(config_flag._FindConfigSpecified(argv), i)
    def testConfigSpecified(self, config_argument):
        """Tests whether config is specified on the command line."""

        config_flag = config_flags._ConfigFlag(parser=flags.ArgumentParser(),
                                               serializer=None,
                                               name='test_config',
                                               default='defaultconfig.py',
                                               help_string='')
        self.assertTrue(config_flag._IsConfigSpecified([config_argument]))
        self.assertFalse(config_flag._IsConfigSpecified(['']))