diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-27 13:50:47 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-27 13:50:47 -0500 |
| commit | c2f86c92b1fbb4e855161bd509d3057f86ed7a74 (patch) | |
| tree | 7993fd70b986b711e1f1e6da9677bb89427b434a /test/base/test_utils.py | |
| parent | b6428219c663e0eb0bf44817391d7a8fc1c60d43 (diff) | |
| download | sqlalchemy-c2f86c92b1fbb4e855161bd509d3057f86ed7a74.tar.gz | |
restore the contracts of update/extend to the degree that the same column identity
isn't appended to the list. reflection makes use of this.
Diffstat (limited to 'test/base/test_utils.py')
| -rw-r--r-- | test/base/test_utils.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/base/test_utils.py b/test/base/test_utils.py index e6ea06296..4ff17e8cc 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -454,6 +454,36 @@ class ColumnCollectionTest(fixtures.TestBase): # the same as the "_all_columns" collection. eq_(list(cc), [c1, c2b, c3]) + def test_extend_existing(self): + cc = sql.ColumnCollection() + + c1, c2, c3, c4, c5 = column('c1'), column('c2'), column('c3'), column('c4'), column('c5') + + cc.extend([c1, c2]) + eq_(cc._all_columns, [c1, c2]) + + cc.extend([c3]) + eq_(cc._all_columns, [c1, c2, c3]) + cc.extend([c4, c2, c5]) + + eq_(cc._all_columns, [c1, c2, c3, c4, c5]) + + def test_update_existing(self): + cc = sql.ColumnCollection() + + c1, c2, c3, c4, c5 = column('c1'), column('c2'), column('c3'), column('c4'), column('c5') + + cc.update([('c1', c1), ('c2', c2)]) + eq_(cc._all_columns, [c1, c2]) + + cc.update([('c3', c3)]) + eq_(cc._all_columns, [c1, c2, c3]) + cc.update([('c4', c4), ('c2', c2), ('c5', c5)]) + + eq_(cc._all_columns, [c1, c2, c3, c4, c5]) + + + class LRUTest(fixtures.TestBase): def test_lru(self): |
