Esempio n. 1
0
 def testApplyArgDefaults_RequiredArgHasNoValue_DefaultApplied(self):
   args = argparse.Namespace(blood=None)
   shared_defaults = fake_args.SharedArgRules()['defaults']
   typed_defaults = fake_args.TypedArgRules()['o-positive']['defaults']
   arg_util.ApplyLowerPriorityArgs(args, shared_defaults)
   arg_util.ApplyLowerPriorityArgs(args, typed_defaults)
   self.assertEqual(args.blood, '1 pint')
Esempio n. 2
0
 def testApplyArgDefaults_OptionalArgHasValue_NoDefaultApplied(self):
   args = argparse.Namespace(tomorrow='2:00PM')
   shared_defaults = fake_args.SharedArgRules()['defaults']
   typed_defaults = fake_args.TypedArgRules()['ab-negative']['defaults']
   arg_util.ApplyLowerPriorityArgs(args, shared_defaults)
   arg_util.ApplyLowerPriorityArgs(args, typed_defaults)
   self.assertEqual(args.tomorrow, '2:00PM')
Esempio n. 3
0
 def testApplyArgDefaults_SharedArgHasNoValue_DefaultApplied(self):
   args = argparse.Namespace(donate=None)
   shared_defaults = fake_args.SharedArgRules()['defaults']
   typed_defaults = fake_args.TypedArgRules()['o-positive']['defaults']
   arg_util.ApplyLowerPriorityArgs(args, shared_defaults)
   arg_util.ApplyLowerPriorityArgs(args, typed_defaults)
   self.assertEqual(args.donate, 'feels-good')
Esempio n. 4
0
 def testArgNamesInRulesAreInternalNames(self):
   # Verify that ArgRules use internal arg names with underscores, not hyphens
   for arg_rules in six.itervalues(fake_args.TypedArgRules()):
     self.CheckArgNamesForHyphens(arg_rules)
   self.CheckArgNamesForHyphens(fake_args.SharedArgRules())
Esempio n. 5
0
 def testGetSetOfAllTestArgs_OnTestRules(self):
   all_args = arg_util.GetSetOfAllTestArgs(fake_args.TypedArgRules(),
                                           fake_args.SharedArgRules())
   self.assertEquals(fake_args.AllArgsSet(), all_args)
Esempio n. 6
0
def _FakeArgManager():
  return arg_manager.AndroidArgsManager(
      catalog_manager.AndroidCatalogManager(fake_args.AndroidCatalog()),
      fake_args.TypedArgRules(),
      fake_args.SharedArgRules())
Esempio n. 7
0
 def _ValidateFakeArgsForTestType(self, args, test_type):
     arg_validate.ValidateArgsForTestType(args, test_type,
                                          fake_args.TypedArgRules(),
                                          fake_args.SharedArgRules(),
                                          fake_args.AllArgsSet())