~ubuntu-branches/debian/sid/sqlalchemy/sid

« back to all changes in this revision

Viewing changes to test/orm/test_expire.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2014-06-27 20:17:13 UTC
  • mfrom: (1.4.28)
  • Revision ID: package-import@ubuntu.com-20140627201713-g6p1kq8q1qenztrv
Tags: 0.9.6-1
* New upstream release
* Remove Python 3.X build tag files, thanks to Matthias Urlichs for the
  patch (closes: #747852)
* python-fdb isn't in the Debian archive yet so default dialect for firebird://
  URLs is changed to obsolete kinterbasdb, thanks to Russell Stuart for the
  patch (closes: #752145)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        # change the value in the DB
47
47
        users.update(users.c.id==7, values=dict(name='jack')).execute()
48
48
        sess.expire(u)
49
 
        # object isnt refreshed yet, using dict to bypass trigger
 
49
        # object isn't refreshed yet, using dict to bypass trigger
50
50
        assert u.__dict__.get('name') != 'jack'
51
51
        assert 'name' in attributes.instance_state(u).expired_attributes
52
52
 
666
666
        assert 'addresses' not in u.__dict__
667
667
 
668
668
        # hit the lazy loader.  just does the lazy load,
669
 
        # doesnt do the overall refresh
 
669
        # doesn't do the overall refresh
670
670
        def go():
671
671
            assert u.addresses[0].email_address=='ed@wood.com'
672
672
        self.assert_sql_count(testing.db, go, 1)
1394
1394
 
1395
1395
    def test_refresh_with_lazy(self):
1396
1396
        """test that when a lazy loader is set as a trigger on an object's attribute
1397
 
        (at the attribute level, not the class level), a refresh() operation doesnt
 
1397
        (at the attribute level, not the class level), a refresh() operation doesn't
1398
1398
        fire the lazy loader or create any problems"""
1399
1399
 
1400
1400
        User, Address, addresses, users = (self.classes.User,