Example #1
0
    def test_validations(self):
        import pyon.util.arg_check as arg_check

        with self.assertRaises(BadRequest):
            arg_check.validateTrue(False,'test')

        with self.assertRaises(BadRequest):
            arg_check.validateEqual(3,4,'test')

        with self.assertRaises(BadRequest):
            arg_check.validateNotEqual(4,4,'test')

        with self.assertRaises(BadRequest):
            arg_check.validateFalse(True,'test')

        with self.assertRaises(BadRequest):
            one = list()
            two = list()
            arg_check.validateIs(one,two,'test')

        with self.assertRaises(BadRequest):
            one = list()
            two = one
            arg_check.validateIsNot(one,two,'test')

        with self.assertRaises(BadRequest):
            c = None
            arg_check.validateIsNotNone(c,'test')

        with self.assertRaises(BadRequest):
            one = list([1,3])
            two = 2
            arg_check.validateIn(two,one,'test')

        with self.assertRaises(BadRequest):
            one = list([1,2,3])
            two = 2
            arg_check.validateNotIn(two,one,'test')

        with self.assertRaises(BadRequest):
            one = list()
            arg_check.validateIsInstance(one,dict,'test')

        with self.assertRaises(BadRequest):
            one = list()
            arg_check.validateNotIsInstance(one,list,'test')
Example #2
0
    def test_validations(self):
        import pyon.util.arg_check as arg_check

        with self.assertRaises(BadRequest):
            arg_check.validateTrue(False, 'test')

        with self.assertRaises(BadRequest):
            arg_check.validateEqual(3, 4, 'test')

        with self.assertRaises(BadRequest):
            arg_check.validateNotEqual(4, 4, 'test')

        with self.assertRaises(BadRequest):
            arg_check.validateFalse(True, 'test')

        with self.assertRaises(BadRequest):
            one = list()
            two = list()
            arg_check.validateIs(one, two, 'test')

        with self.assertRaises(BadRequest):
            one = list()
            two = one
            arg_check.validateIsNot(one, two, 'test')

        with self.assertRaises(BadRequest):
            c = None
            arg_check.validateIsNotNone(c, 'test')

        with self.assertRaises(BadRequest):
            one = list([1, 3])
            two = 2
            arg_check.validateIn(two, one, 'test')

        with self.assertRaises(BadRequest):
            one = list([1, 2, 3])
            two = 2
            arg_check.validateNotIn(two, one, 'test')

        with self.assertRaises(BadRequest):
            one = list()
            arg_check.validateIsInstance(one, dict, 'test')

        with self.assertRaises(BadRequest):
            one = list()
            arg_check.validateNotIsInstance(one, list, 'test')
Example #3
0
 def check_equality(self, a, b):
     '''
     You needed to be sure that two items we're equivalent
     '''
     validateEqual(a, b, '%s != %s' % (str(a), str(b)))
     return True
Example #4
0
 def check_equality(self, a, b):
     """
     You needed to be sure that two items we're equivalent
     """
     validateEqual(a, b, "%s != %s" % (str(a), str(b)))
     return True