Example #1
0
 def test_ok(self):
     try:
         for i, test in enumerate(ok_tests):
             if len(test) == 2:
                 self.assertEqual(validate(test[0], test[1]), test[1])
             else:
                 self.assertEqual(validate(test[0], test[1]), test[2])
     except Exception as e:
         print("Failed test_ok @%d iteration: %s" % (i, test))
         raise
Example #2
0
 def test_bad_lists(self):
     try:
         for i, test in enumerate(bad_list_tests):
             try:
                 result = validate(test[0], test[1])
                 self.fail("should raise")
             except ValidationError as e:
                 #print(e.js)
                 self.assertEqual(e.js, test[2])
     except Exception as e:
         print("Failed test_bad_lists @%d iteration: %s" % (i, test))
         raise