diff options
author | Federico Caselli <cfederico87@gmail.com> | 2020-03-23 21:17:01 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2020-03-24 19:59:52 +0100 |
commit | 7f863344b96c945c56791d31b15a302c2ddd800f (patch) | |
tree | 6b83862084b22ccdf1436c60c5d3e82caeb80821 /test/base/test_utils.py | |
parent | e6b6ec78e6d6f96537eaf542f469a7e88134e9fc (diff) | |
download | sqlalchemy-7f863344b96c945c56791d31b15a302c2ddd800f.tar.gz |
Improve the method ``__str__`` of :class:`ColumnCollection`
The change avoids confusing a :class:`ColumnCollection` with a python list since the
previous string representation was the same.
Fixes: #5191
Change-Id: Icdbc08f9991d31ce86372505e3614740eaee56e2
Diffstat (limited to 'test/base/test_utils.py')
-rw-r--r-- | test/base/test_utils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/base/test_utils.py b/test/base/test_utils.py index 4392df013..662baa38a 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -537,6 +537,17 @@ class ColumnCollectionCommon(testing.AssertsCompiledSQL): ).compare(self._column_collection([("col1", c1), ("col2", c2)])) ) + def test_str(self): + c1 = sql.column("col1") + c2 = c1.label("col2") + c3 = sql.column("col3") + cc = self._column_collection( + [("col1", c1), ("col2", c2), ("col3", c3)] + ) + + eq_(str(cc), "%s(%s, %s, %s)" % (type(cc).__name__, c1, c2, c3)) + eq_(repr(cc), object.__repr__(cc)) + class ColumnCollectionTest(ColumnCollectionCommon, fixtures.TestBase): def _column_collection(self, columns=None): |