Changeset 872 for trunk/tests


Ignore:
Timestamp:
Apr 9, 2016, 6:53:52 AM (3 years ago)
Author:
cito
Message:

Prefer OID over PK in update() and delete()

This restores backward compatibility with Python 4.x and allows to update
the primary key by identifying the row via the OID.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/test_classic_dbwrapper.py

    r857 r872  
    17661766        r = query(q).getresult()
    17671767        self.assertEqual(r, [(1, 3), (5, 9)])
     1768        s.update(n=4, m=7)
     1769        r = update('test_table', s, oid=oid)
     1770        self.assertIs(r, s)
     1771        self.assertEqual(r['n'], 4)
     1772        self.assertEqual(r['m'], 7)
     1773        r = query(q).getresult()
     1774        self.assertEqual(r, [(1, 3), (4, 7)])
    17681775
    17691776    def testUpdateWithoutOid(self):
     
    22452252        r = delete('test_table', s, n=5)
    22462253        self.assertEqual(r, 0)
    2247         self.assertEqual(query(q).getresult()[0], (6, 1))
     2254        s = get('test_table', 6, 'n')
     2255        self.assertEqual(s['n'], 6)
     2256        s['n'] = 7
     2257        r = delete('test_table', s)
     2258        self.assertEqual(r, 1)
     2259        self.assertEqual(query(q).getresult()[0], (None, 0))
    22482260
    22492261    def testDeleteWithCompositeKey(self):
Note: See TracChangeset for help on using the changeset viewer.