Skip to content

Add test to ensure every table update has corresponding _apply_table_update function #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/table/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,3 +1378,13 @@ def test_remove_statistics_update(table_v2_with_statistics: Table) -> None:
table_v2_with_statistics.metadata,
(RemoveStatisticsUpdate(snapshot_id=123456789),),
)


def test_all_table_updates_have_dispatch() -> None:
# ensures that every TableUpdate subclass has a corresponding `_apply_table_update` dispatch function.
from pyiceberg.table.update import TableUpdate, _apply_table_update

table_update_classes = set(TableUpdate.__origin__.__args__) # type: ignore
dispatch_classes = set(_apply_table_update.registry.keys())
missing_dispatch = table_update_classes - dispatch_classes
assert not missing_dispatch, f"Missing dispatch function for: {missing_dispatch}"