import pydantic from common.src.models import sql TEST_FIELD = "test_field" TEST_VALUE = "test_value" class TestBaseColumns: _class = sql.BaseColumns class TestColumns(_class): test_field: str = pydantic.Field(..., alias=TEST_FIELD) def test_base_columns_can_be_subclassed(self): """Test that the BaseColumns class can be subclassed and that the subclass can be instantiated with the correct parameters. """ test_columns = self.TestColumns(test_field=TEST_VALUE) assert test_columns.test_field == TEST_VALUE, ( f"Expected test_field to be {TEST_VALUE}, " f"but got {test_columns.test_field}" ) def test_base_columns_has_alias_method(self): """Test that the BaseColumns class has an alias method.""" # Subclass the BaseColumns class to test the alias method test_columns = self.TestColumns(test_field=TEST_VALUE) assert ( test_columns.alias(TEST_FIELD) == TEST_FIELD ), f"alias method is not returning the correct alias, should be {TEST_FIELD}"