(core) Test undo for all Python summary table tests

Summary:
Undo often leads to errors, especially with summary tables. One example is here: https://grist.slack.com/archives/C069RUP71/p1662564341132349

This diff simply decorates all relevant tests in 3 files testing summary tables with `@test_engine.test_undo`. This didn't catch any new bugs or reveal the problem in the thread above, but it seems good to have.

Test Plan: this

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3624
This commit is contained in:
Alex Hall
2022-09-07 17:41:30 +02:00
parent 2438a63255
commit 0a2bc56938
3 changed files with 22 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ class TestSummary2(test_engine.EngineTestCase):
starting_table_data = test_summary.TestSummary.starting_table_data
@test_engine.test_undo
def test_add_summary_formula(self):
# Verify that we can add a summary formula; that new sections automatically get columns
# matching the source table, and not other columns. Check that group-by columns override
@@ -162,6 +163,7 @@ class TestSummary2(test_engine.EngineTestCase):
#----------------------------------------------------------------------
@test_engine.test_undo
def test_summary_col_rename(self):
# Verify that renaming a column in a source table causes appropriate renames in the summary
# tables, and that renames of group-by columns in summary tables are disallowed.
@@ -328,6 +330,7 @@ class TestSummary2(test_engine.EngineTestCase):
[21, 'foo3', True, 'WidgetOptions2'],
], rows=lambda r: r.colId in ('foo2', 'foo3'))
@test_engine.test_undo
def test_summary_col_rename_conflict(self):
sample = testutil.parse_test_sample({
"SCHEMA": [
@@ -418,6 +421,7 @@ class TestSummary2(test_engine.EngineTestCase):
tables = [table1, fake_summary, summary_by_a_and_b, summary_by_a]
self.assertTables(tables)
@test_engine.test_undo
def test_source_table_rename_conflict(self):
sample = testutil.parse_test_sample({
"SCHEMA": [
@@ -469,6 +473,7 @@ class TestSummary2(test_engine.EngineTestCase):
#----------------------------------------------------------------------
@test_engine.test_undo
def test_restrictions(self):
# Verify various restrictions on summary tables
# (1) no adding/removing/renaming non-formula columns.
@@ -553,6 +558,7 @@ class TestSummary2(test_engine.EngineTestCase):
#----------------------------------------------------------------------
@test_engine.test_undo
def test_update_summary_section(self):
# Verify that we can change the group-by for a view section, and that unused tables get
# removed.
@@ -876,6 +882,7 @@ class TestSummary2(test_engine.EngineTestCase):
#----------------------------------------------------------------------
@test_engine.test_undo
def test_update_groupby_override(self):
# Verify that if we add a group-by column that conflicts with a formula, group-by column wins.
@@ -939,6 +946,7 @@ class TestSummary2(test_engine.EngineTestCase):
#----------------------------------------------------------------------
@test_engine.test_undo
def test_cleanup_on_view_remove(self):
# Verify that if we remove a view, that unused summary tables get cleaned up.
@@ -1067,6 +1075,7 @@ class TestSummary2(test_engine.EngineTestCase):
])
#----------------------------------------------------------------------
@test_engine.test_undo
def test_detach_summary_section(self):
# Verify that "DetachSummaryViewSection" useraction works correctly.
@@ -1185,6 +1194,7 @@ class TestSummary2(test_engine.EngineTestCase):
])
#----------------------------------------------------------------------
@test_engine.test_undo
def test_summary_of_detached(self):
# Verify that we can make a summary table of a detached table. This is mainly to ensure that
# we handle well the presence of columns like 'group' and 'count' in the source table.