kevinjqliu opened a new pull request, #952:
URL: https://github.com/apache/iceberg-python/pull/952
While looking at #864 and #950, I noticed that some TableUpdate classes do
not have corresponding `_apply_table_update` function.
I think we should enforce this in tests so that any future TableUpdate have
the necessary `_apply_table_update` to process the update.
### Example
This test currently fails since `RemoveSnapshotRefUpdate` and
`RemoveSnapshotsUpdate` both are missing corresponding `_apply_table_update`
function.
Run:
`poetry run pytest
tests/table/test_init.py::test_table_update_have_corresponding_dispatch`
```
================================================================== FAILURES
==================================================================
_______________________________________________
test_table_update_have_corresponding_dispatch
________________________________________________
def test_table_update_have_corresponding_dispatch() -> None:
from pyiceberg.table import TableUpdate, _apply_table_update
# every TableUpdate class should have corresponding
`_apply_table_update` dispatch function
table_update_class = set(TableUpdate.__origin__.__args__) # type:
ignore
dispatch_function_class = set(_apply_table_update.registry.keys())
missing_dispatch_function = table_update_class -
dispatch_function_class
> assert len(missing_dispatch_function) == 0, f"Missing dispatch
function for {missing_dispatch_function}"
E AssertionError: Missing dispatch function for {<class
'pyiceberg.table.RemoveSnapshotRefUpdate'>, <class
'pyiceberg.table.RemoveSnapshotsUpdate'>}
E assert 2 == 0
E + where 2 = len({<class
'pyiceberg.table.RemoveSnapshotRefUpdate'>, <class
'pyiceberg.table.RemoveSnapshotsUpdate'>})
tests/table/test_init.py:1166: AssertionError
========================================================== short test
summary info ===========================================================
FAILED
tests/table/test_init.py::test_table_update_have_corresponding_dispatch -
AssertionError: Missing dispatch function for {<class
'pyiceberg.table.RemoveSnapshotRefUpdate'>, <class
'pyiceberg.table.RemoveSnapshots...
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]