Ticket #8740: 8740_r8911_save_force_update.v3.diff

File 8740_r8911_save_force_update.v3.diff, 821 bytes (added by Richard Davies <richard.davies@…>, 16 years ago)

Patch to modeltests/force_insert_update so that it will fail unless a consistent exception is raised

  • tests/modeltests/force_insert_update/models.py

     
    5454
    5555# Trying to update should still fail, even with manual primary keys, if the
    5656# data isn't in the database already.
     57>>> sid = transaction.savepoint()
    5758>>> obj = WithCustomPK(name=1, value=1)
    58 >>> obj.save(force_update=True)
    59 Traceback (most recent call last):
    60 ...
    61 DatabaseError: ...
     59>>> try:
     60...     obj.save(force_update=True)
     61... except Exception, e:
     62...     if isinstance(e, IntegrityError):
     63...         print "Pass"
     64...     else:
     65...         print "Fail with %s" % type(e)
     66Pass
     67>>> transaction.savepoint_rollback(sid)
    6268
    6369"""
    6470}
Back to Top