示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)