def test_context_update(self):
     us = UpdateStatement('table')
     us.add_assignment(Column(db_field='a'), 'b')
     us.add_assignment(Column(db_field='c'), 'd')
     us.add_where(Column(db_field='a'), EqualsOperator(), 'x')
     us.update_context_id(3)
     self.assertEqual(six.text_type(us), 'UPDATE table SET "a" = %(4)s, "c" = %(5)s WHERE "a" = %(3)s')
     self.assertEqual(us.get_context(), {'4': 'b', '5': 'd', '3': 'x'})
Example #2
0
 def test_context_update(self):
     us = UpdateStatement('table')
     us.add_assignment(Column(db_field='a'), 'b')
     us.add_assignment(Column(db_field='c'), 'd')
     us.add_where(Column(db_field='a'), EqualsOperator(), 'x')
     us.update_context_id(3)
     self.assertEqual(six.text_type(us), 'UPDATE table SET "a" = %(4)s, "c" = %(5)s WHERE "a" = %(3)s')
     self.assertEqual(us.get_context(), {'4': 'b', '5': 'd', '3': 'x'})
 def test_context_update(self):
     us = UpdateStatement('table')
     us.add_assignment_clause(AssignmentClause('a', 'b'))
     us.add_assignment_clause(AssignmentClause('c', 'd'))
     us.add_where_clause(WhereClause('a', EqualsOperator(), 'x'))
     us.update_context_id(3)
     self.assertEqual(six.text_type(us), 'UPDATE table SET "a" = %(4)s, "c" = %(5)s WHERE "a" = %(3)s')
     self.assertEqual(us.get_context(), {'4': 'b', '5': 'd', '3': 'x'})
Example #4
0
 def test_context_update(self):
     us = UpdateStatement('table')
     us.add_assignment_clause(AssignmentClause('a', 'b'))
     us.add_assignment_clause(AssignmentClause('c', 'd'))
     us.add_where_clause(WhereClause('a', EqualsOperator(), 'x'))
     us.update_context_id(3)
     self.assertEqual(
         six.text_type(us),
         'UPDATE table SET "a" = %(4)s, "c" = %(5)s WHERE "a" = %(3)s')
     self.assertEqual(us.get_context(), {'4': 'b', '5': 'd', '3': 'x'})