コード例 #1
0
 def test_delete_values(self):
     s = SQLGenerator()
     self.assertEqual(s.delete('test', {'nom': 'dupont'}),
                      'DELETE FROM test WHERE nom = %(nom)s')
     self.assertEqual(
         s.delete('test', {
             'nom': 'dupont',
             'prenom': 'jean'
         }), 'DELETE FROM test WHERE nom = %(nom)s AND prenom = %(prenom)s')
コード例 #2
0
 def test_delete_functions(self):
     s = SQLGenerator()
     params = {
         'nom': 'dupont',
         'prenom': 'jean',
         'age': SQLExpression('YEARS(%(date)s)', date='2013/01/01')
     }
     self.assertEqual(
         s.delete('test', params),
         'DELETE FROM test WHERE age = YEARS(%(date)s) '
         'AND nom = %(nom)s AND prenom = %(prenom)s')
     self.assertEqual(params, {
         'nom': 'dupont',
         'prenom': 'jean',
         'date': '2013/01/01'
     })