diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-03-19 12:32:47 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-03-19 15:27:39 -0400 |
commit | 52ef05c936170109f2f457751f4940e4269595c3 (patch) | |
tree | 69f30d91d528b34130d77bdccdc295d78fcc7482 /tests/test_autogen_diffs.py | |
parent | 4f351a6ca8a6b5fe6718203226805f4e1a02a2db (diff) | |
download | alembic-52ef05c936170109f2f457751f4940e4269595c3.tar.gz |
Use looser tokenization for type comparison
Fixed more false-positive failures produced by the new "compare type" logic
first added in :ticket:`605`, particularly impacting MySQL string types
regarding flags such as "charset" and "collation".
Change-Id: If3dcfed7b0aa2d7367e1508289a0b5ee6f4c15a7
Fixes: #617
Diffstat (limited to 'tests/test_autogen_diffs.py')
-rw-r--r-- | tests/test_autogen_diffs.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_autogen_diffs.py b/tests/test_autogen_diffs.py index e1e5c8d..ad38765 100644 --- a/tests/test_autogen_diffs.py +++ b/tests/test_autogen_diffs.py @@ -786,6 +786,8 @@ class CompareMetadataToInspectorTest(TestBase): # that have not changed. is_(self._compare_columns(cola, cola), False) + # TODO: ideally the backend-specific types would be tested + # within the test suites for those backends. @testing.combinations( (String(32), VARCHAR(32), False), (VARCHAR(6), String(6), False), @@ -795,6 +797,40 @@ class CompareMetadataToInspectorTest(TestBase): (Unicode(32), VARCHAR(32), False, config.requirements.unicode_string), (VARCHAR(6), VARCHAR(12), True), (VARCHAR(6), String(12), True), + (Integer(), String(10), True), + (String(10), Integer(), True), + ( + Unicode(30, collation="en_US"), + Unicode(30, collation="en_US"), + False, # unfortunately dialects don't seem to consistently + # reflect collations right now so we can't test for + # positives here + config.requirements.postgresql, + ), + ( + mysql.VARCHAR(200, charset="utf8"), + Unicode(200), + False, + config.requirements.mysql, + ), + ( + mysql.VARCHAR(200, charset="latin1"), + mysql.VARCHAR(200, charset="utf-8"), + True, + config.requirements.mysql + config.requirements.sqlalchemy_13, + ), + ( + String(255, collation="utf8_bin"), + String(255), + False, + config.requirements.mysql, + ), + ( + String(255, collation="utf8_bin"), + String(255, collation="latin1_bin"), + True, + config.requirements.mysql + config.requirements.sqlalchemy_13, + ), ) def test_string_comparisons(self, cola, colb, expect_changes): is_(self._compare_columns(cola, colb), expect_changes) |