diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-03-16 23:56:28 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-03-17 00:31:59 +0100 |
commit | 82070dd0c719f7683e47c3983f949c64a46b92f9 (patch) | |
tree | 5c05cdc4b2367972b3e49284fa539037fcfb2c7c /test/base/test_utils.py | |
parent | ade13e54cd2b2b7dce7eb8e3471ad998ceb630b4 (diff) | |
download | sqlalchemy-82070dd0c719f7683e47c3983f949c64a46b92f9.tar.gz |
Added back ``items`` and ``values`` to ``ColumnCollection`` class.
Fixes: #6068
Change-Id: Idb42c864e17c02d7b89cffa667dcf853ec93e5c2
Diffstat (limited to 'test/base/test_utils.py')
-rw-r--r-- | test/base/test_utils.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/base/test_utils.py b/test/base/test_utils.py index a00fbd018..b602811ab 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -464,11 +464,39 @@ class ColumnCollectionCommon(testing.AssertsCompiledSQL): cc = self._column_collection( columns=[("c1", c1), ("foo", c2), ("c3", c3)] ) - eq_(cc.keys(), ["c1", "foo", "c3"]) + keys = cc.keys() + eq_(keys, ["c1", "foo", "c3"]) + ne_(id(keys), id(cc.keys())) ci = cc.as_immutable() eq_(ci.keys(), ["c1", "foo", "c3"]) + def test_values(self): + c1, c2, c3 = sql.column("c1"), sql.column("c2"), sql.column("c3") + c2.key = "foo" + cc = self._column_collection( + columns=[("c1", c1), ("foo", c2), ("c3", c3)] + ) + val = cc.values() + eq_(val, [c1, c2, c3]) + ne_(id(val), id(cc.values())) + + ci = cc.as_immutable() + eq_(ci.values(), [c1, c2, c3]) + + def test_items(self): + c1, c2, c3 = sql.column("c1"), sql.column("c2"), sql.column("c3") + c2.key = "foo" + cc = self._column_collection( + columns=[("c1", c1), ("foo", c2), ("c3", c3)] + ) + items = cc.items() + eq_(items, [("c1", c1), ("foo", c2), ("c3", c3)]) + ne_(id(items), id(cc.items())) + + ci = cc.as_immutable() + eq_(ci.items(), [("c1", c1), ("foo", c2), ("c3", c3)]) + def test_key_index_error(self): cc = self._column_collection( columns=[ |