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')
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')
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')
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())
def testGetSetOfAllTestArgs_OnTestRules(self): all_args = arg_util.GetSetOfAllTestArgs(fake_args.TypedArgRules(), fake_args.SharedArgRules()) self.assertEquals(fake_args.AllArgsSet(), all_args)
def _FakeArgManager(): return arg_manager.AndroidArgsManager( catalog_manager.AndroidCatalogManager(fake_args.AndroidCatalog()), fake_args.TypedArgRules(), fake_args.SharedArgRules())
def _ValidateFakeArgsForTestType(self, args, test_type): arg_validate.ValidateArgsForTestType(args, test_type, fake_args.TypedArgRules(), fake_args.SharedArgRules(), fake_args.AllArgsSet())