Пример #1
0
 def test_validate_wrong_problem(self):
     """ Test to validate with DES a wrong SelectProblem """
     problem = SelectProblem(create_sql='CREATE TABLE t(age int)',
                             insert_sql='',
                             solution='SELECT * FROM table')
     problem2 = SelectProblem(create_sql='CREATE TABLE t(age int)',
                              insert_sql='',
                              solution='SELECT * FRO t')
     with self.assertRaises(ValidationError) as ctx:
         problem.validate_des()
     self.assertIn("Unknown table or view 'table'", ctx.exception.message)
     with self.assertRaises(ValidationError) as ctx:
         problem2.validate_des()
     self.assertIn("Expected FROM clause", ctx.exception.message)
Пример #2
0
 def test_validate_correct_problem(self):
     """ Test to validate with DES a correct SelectProblem """
     problem = SelectProblem(create_sql='CREATE TABLE t(age int)',
                             insert_sql='',
                             solution='SELECT * FROM t')
     self.assertIsNone(problem.validate_des())