def test_single(self): # ARRANGE # renderer = sut.ArgumentUsageOnCommandLineRenderer() argument_usage = arg.Single(arg.Multiplicity.OPTIONAL, arg.Named('name')) # ACT # actual = renderer.visit(argument_usage) # ASSERT # self.assertEqual('[name]', actual)
def test_choice__single_argument_choices(self): # ARRANGE # renderer = sut.ArgumentUsageOnCommandLineRenderer() argument_usage = arg.Choice.of_single_argument_choices( arg.Multiplicity.OPTIONAL, [arg.Named('name1'), arg.Named('name2')], ) # ACT # actual = renderer.visit(argument_usage) # ASSERT # self.assertEqual('[name1|name2]', actual)
def test_choice__multiple_argument_choices(self): # ARRANGE # renderer = sut.ArgumentUsageOnCommandLineRenderer() for choices_case in _CHOICE_MULTIPLE_CHOICE_ARGUMENTS_CASES: with self.subTest(choices_case.name): argument_usage = _choice_w_multiple_args_from_strings( arg.Multiplicity.OPTIONAL, choices_case.input_value, ) # ACT # actual = renderer.visit(argument_usage) # ASSERT # expected = _optional__choice(choices_case.expected_value) self.assertEqual(expected, actual)
def test_choice__single_argument_choices(self): # ARRANGE # args_cases = [ ['name1', 'name2'], ['name1', 'name2', 'name3'], ] renderer = sut.ArgumentUsageOnCommandLineRenderer() for args_case in args_cases: with self.subTest(repr(args_case)): argument_usage = arg.Choice.of_single_argument_choices( arg.Multiplicity.ONE_OR_MORE, [arg.Named(arg_name) for arg_name in args_case], ) # ACT # actual = renderer.visit(argument_usage) # ASSERT # self.assertEqual('({})...'.format('|'.join(args_case)), actual)