def test_assortment_fails(self): arg = "--foo" params = { "required": True, "arg_type": [1.2, 2.3], } given = None with self.assertRaises(ValidationException): transform_argument(arg, params, given)
def test_assortment_with_default(self): arg = "--foo" params = {"required": False, "default": 0} given = None gold = ("--foo", 0) output = transform_argument(arg, params, given) self.assertEqual(gold, output)
def test_no_given_value_not_required(self): arg = "--foo" params = {"required": False} given = None gold = None output = transform_argument(arg, params, given) self.assertEqual(gold, output)
def test_no_params_given_value(self): arg = "--foo" params = int given = "1" gold = ("--foo", 1) output = transform_argument(arg, params, given) self.assertEqual(gold, output)
def test_assortment_passes(self): arg = "--foo" params = { "required": False, "arg_type": [1.2, 2.3], } given = "1.2" gold = ("--foo", 1.2) output = transform_argument(arg, params, given) self.assertEqual(gold, output)