From 35f7fda3eb214b9e6172852bb00f44ccab53886b Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Thu, 9 Jul 2020 10:35:33 -0400 Subject: [PATCH] Improvements to test_computed_col_default_not_set ### Description - Update the test so it looks at computed_default_table instead of computed_column_table. - Stop inspecting autoincrement; instead directly check for default/non-default values for the relevant columns. Fixes: #5414 ### Checklist This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [x] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #` in the commit message - please include tests. **Have a nice day!** Closes: #5417 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5417 Pull-request-sha: 5918af6abb991e6d2322ea4252e56d456da628dc Change-Id: Id9484ae7f297735345016be5b7461325825503da --- lib/sqlalchemy/testing/suite/test_reflection.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index 7080888813..84b3aba5be 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -1171,12 +1171,11 @@ class ComputedReflectionTest(fixtures.ComputedReflectionFixtureTest): def test_computed_col_default_not_set(self): insp = inspect(config.db) - cols = insp.get_columns("computed_column_table") - for col in cols: - if col["name"] == "with_default": - is_true("42" in col["default"]) - elif not col["autoincrement"]: - is_(col["default"], None) + cols = insp.get_columns("computed_default_table") + col_data = {c["name"]: c for c in cols} + is_true("42" in col_data["with_default"]["default"]) + is_(col_data["normal"]["default"], None) + is_(col_data["computed_col"]["default"], None) def test_get_column_returns_computed(self): insp = inspect(config.db) -- 2.39.5