Skip to content

Commit ddab0e1

Browse files
djwaldoclaude
andcommitted
test(thoughtspot): pin the last three loops that an empty collection satisfied
The remainder of the fail-open sweep. These were lower priority than the six in cc5db0e because a sibling test happened to fail on the same mutation -- but "another test noticed" is not the same as this test working, and the sibling can be deleted or narrowed later without anyone seeing the cover disappear. `test_every_table_or_sql_view_document_is_present` compares two sets, and `set() == set()` holds, so a fixture with no table documents satisfied it and the two sibling tests that walk the same collection. Pinned once for all three. `test_column_type_is_never_a_bare_root_key` reads columns through a helper that ends `or []`, so a model emitting no columns passed without checking one. Not changed, deliberately: the ~16 tests whose loop iterable is a literal list written inline in the test body. Those can only go empty if someone edits the assertion out by hand, which no guard can prevent, and the six catalog `test_classifications` tests already have a sibling pinning an exact row count. 942 tests pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent a2a590d commit ddab0e1

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎converters/thoughtspot/tests/test_ossie_to_thoughtspot_model.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@ def test_column_type_is_never_a_bare_root_key(self):
510510
doc = build_model(model, [orders], IssueLog())
511511
columns, _formulas = _all_columns_and_formulas(doc.body)
512512

513+
# `_all_columns_and_formulas` reads `body.get("columns") or []`, so an
514+
# emitted model with no columns would pass this without checking one.
515+
assert columns, "build_model emitted no columns to check placement on"
513516
for column in columns:
514517
assert "column_type" not in column
515518
assert column["properties"]["column_type"] in ("ATTRIBUTE", "MEASURE")

‎converters/thoughtspot/tests/test_roundtrip.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,23 @@ def test_every_table_or_sql_view_document_is_present(self, fixture_name):
198198
document_set, _, tml_result = _tml_roundtrip(fixture_name)
199199
original_names = {t.body["name"] for t in document_set.tables}
200200
new_names = {t.body["name"] for t in tml_result.documents.tables}
201+
# `set() == set()` is true, so the fixture having no tables at all would
202+
# satisfy this and the two sibling tests below, which walk the same
203+
# collection. Pinned here once, for all three.
204+
assert original_names, f"{fixture_name} has no table documents to compare"
201205
assert new_names == original_names
202206

203207
def test_every_physical_column_survives_with_its_exact_content(self, fixture_name):
204208
document_set, _, tml_result = _tml_roundtrip(fixture_name)
209+
assert document_set.tables, f"{fixture_name} has no table documents"
205210
for original in document_set.tables:
206211
new = _table_by_name(tml_result.documents, original.body["name"])
207212
assert new.kind == original.kind
208213
assert _columns_by_name(new.body) == _columns_by_name(original.body)
209214

210215
def test_shared_table_level_attributes_survive(self, fixture_name):
211216
document_set, _, tml_result = _tml_roundtrip(fixture_name)
217+
assert document_set.tables, f"{fixture_name} has no table documents"
212218
for original in document_set.tables:
213219
new = _table_by_name(tml_result.documents, original.body["name"])
214220
# "joins_with" included: a Table-referenced join's own

0 commit comments

Comments
 (0)