more tests

This commit is contained in:
Kenneth Kehl
2025-07-07 14:25:20 -07:00
parent af4e6e93bf
commit ca32237fe5

View File

@@ -1,6 +1,9 @@
from unittest.mock import MagicMock
from app.history_meta import _get_bases_for_versioned_class
from app.history_meta import (
_get_bases_for_versioned_class,
_handle_single_table_inheritance,
)
def test_get_bases_with_super_history_and_table():
@@ -55,3 +58,27 @@ def test_get_bases_without_super_history():
assert bases == (Base,)
assert "changed" not in properties
def _col_copy(col):
return f"copied_{col.key}"
def test_handle_single_table_inheritance():
col1 = MagicMock()
col1.key = "id"
col2 = MagicMock()
col2.key = "new_column"
local_mapper = MagicMock()
local_mapper.local_table.c = [col1, col2]
super_history_mapper = MagicMock()
super_history_mapper.local_table.c = {"id": col1}
super_history_mapper.local_table.append_column = MagicMock()
_handle_single_table_inheritance(local_mapper, super_history_mapper)
super_history_mapper.local_table.append_column.assert_called_once_with(
"copied_new_column"
)