예제 #1
0
 def test_delete_many_values(self):
     s = SQLGenerator()
     params = {'nom': 'dupont', 'eid': '(1, 2, 3)'}
     self.assertEqual(
         s.delete_many('test', params),
         'DELETE FROM test WHERE eid IN (1, 2, 3) AND nom = %(nom)s')
     self.assertEqual(params, {'nom': 'dupont'})
예제 #2
0
 def test_delete_many_functions(self):
     s = SQLGenerator()
     params = {
         'nom': 'dupont',
         'prenom': 'jean',
         'eid': '(1, 2, 3)',
         'age': SQLExpression('YEARS(%(date)s)', date='2013/01/01')
     }
     self.assertEqual(
         s.delete_many('test', params),
         'DELETE FROM test WHERE eid IN (1, 2, 3) AND age = YEARS(%(date)s) '
         'AND nom = %(nom)s AND prenom = %(prenom)s')
     self.assertEqual(params, {
         'nom': 'dupont',
         'prenom': 'jean',
         'date': '2013/01/01'
     })