add fixes for fastapi model clones, add functionality to add and remove models to relation, add relation proxy, fix all tests, adding values also to pydantic model __dict__some refactors
This commit is contained in:
@ -54,7 +54,9 @@ class ExampleModel2(Model):
|
||||
|
||||
@pytest.fixture()
|
||||
def example():
|
||||
return ExampleModel(pk=1, test_string="test", test_bool=True, test_decimal=decimal.Decimal(3.5))
|
||||
return ExampleModel(
|
||||
pk=1, test_string="test", test_bool=True, test_decimal=decimal.Decimal(3.5)
|
||||
)
|
||||
|
||||
|
||||
def test_not_nullable_field_is_required():
|
||||
@ -110,6 +112,7 @@ def test_sqlalchemy_table_is_created(example):
|
||||
|
||||
def test_no_pk_in_model_definition():
|
||||
with pytest.raises(ModelDefinitionError):
|
||||
|
||||
class ExampleModel2(Model):
|
||||
class Meta:
|
||||
tablename = "example3"
|
||||
@ -120,6 +123,7 @@ def test_no_pk_in_model_definition():
|
||||
|
||||
def test_two_pks_in_model_definition():
|
||||
with pytest.raises(ModelDefinitionError):
|
||||
|
||||
class ExampleModel2(Model):
|
||||
class Meta:
|
||||
tablename = "example3"
|
||||
@ -131,6 +135,7 @@ def test_two_pks_in_model_definition():
|
||||
|
||||
def test_setting_pk_column_as_pydantic_only_in_model_definition():
|
||||
with pytest.raises(ModelDefinitionError):
|
||||
|
||||
class ExampleModel2(Model):
|
||||
class Meta:
|
||||
tablename = "example4"
|
||||
@ -141,6 +146,7 @@ def test_setting_pk_column_as_pydantic_only_in_model_definition():
|
||||
|
||||
def test_decimal_error_in_model_definition():
|
||||
with pytest.raises(ModelDefinitionError):
|
||||
|
||||
class ExampleModel2(Model):
|
||||
class Meta:
|
||||
tablename = "example5"
|
||||
@ -151,6 +157,7 @@ def test_decimal_error_in_model_definition():
|
||||
|
||||
def test_string_error_in_model_definition():
|
||||
with pytest.raises(ModelDefinitionError):
|
||||
|
||||
class ExampleModel2(Model):
|
||||
class Meta:
|
||||
tablename = "example6"
|
||||
|
||||
Reference in New Issue
Block a user