diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-02-25 18:55:09 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-02-25 18:55:09 -0500 |
| commit | 95297c35442e483bb98b5a4edb677bb168064f5e (patch) | |
| tree | 4f266c531075328b763664ccfa73c5066eedd6af /test/orm/test_sync.py | |
| parent | 4715aadab3f053c142750879c8fec15c976fff9c (diff) | |
| download | sqlalchemy-95297c35442e483bb98b5a4edb677bb168064f5e.tar.gz | |
Detection of a primary key change within the process
of cascading a natural primary key update will succeed
even if the key is composite and only some of the
attributes have changed.
[ticket:2665]
Diffstat (limited to 'test/orm/test_sync.py')
| -rw-r--r-- | test/orm/test_sync.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/orm/test_sync.py b/test/orm/test_sync.py index a2c894725..c5825e88b 100644 --- a/test/orm/test_sync.py +++ b/test/orm/test_sync.py @@ -212,6 +212,29 @@ class SyncTest(fixtures.MappedTest, True ) + def test_source_modified_composite(self): + uowcommit, a1, b1, a_mapper, b_mapper = self._fixture() + a1.obj().foo = 10 + a1._commit_all(a1.dict) + a1.obj().foo = 12 + pairs = [(a_mapper.c.id, b_mapper.c.id,), + (a_mapper.c.foo, b_mapper.c.id)] + eq_( + sync.source_modified(uowcommit, a1, a_mapper, pairs), + True + ) + + def test_source_modified_composite_unmodified(self): + uowcommit, a1, b1, a_mapper, b_mapper = self._fixture() + a1.obj().foo = 10 + a1._commit_all(a1.dict) + pairs = [(a_mapper.c.id, b_mapper.c.id,), + (a_mapper.c.foo, b_mapper.c.id)] + eq_( + sync.source_modified(uowcommit, a1, a_mapper, pairs), + False + ) + def test_source_modified_no_unmapped(self): uowcommit, a1, b1, a_mapper, b_mapper = self._fixture() pairs = [(b_mapper.c.id, b_mapper.c.id,)] |
