fake_data#
Functions#
Prepare ORM objects for 'приказать'. |
|
Return schema versions of the ORM models. |
|
Insert the word and morphemes into the database so that they have IDs and return the schema versions of those. |
get_breakdown_orm_objs()#
- tests.functional_tests.main.endpoints.fake_data.get_breakdown_orm_objs() Tuple[rootski.services.database.models.models.Word, List[rootski.services.database.models.models.Morpheme]][source]#
Prepare ORM objects for ‘приказать’.
get_schemas_from_models()#
- tests.functional_tests.main.endpoints.fake_data.get_schemas_from_models(word: rootski.services.database.models.models.Word, morphemes: List[rootski.services.database.models.models.Morpheme]) Tuple[rootski.schemas.word.WordInDb, List[tests.functional_tests.main.endpoints.fake_data.NonstrictMorphemeInDb]][source]#
Return schema versions of the ORM models. They won’t have IDs if the ORM models haven’t been queried from/inserted into the database.
insert_test_objs()#
- tests.functional_tests.main.endpoints.fake_data.insert_test_objs(db: rootski.services.database.database.DBService, word: rootski.services.database.models.models.Word, morphemes: List[rootski.services.database.models.models.Morpheme]) Tuple[rootski.schemas.word.WordInDb, List[rootski.schemas.morpheme.MorphemeInDb]][source]#
Insert the word and morphemes into the database so that they have IDs and return the schema versions of those.
Classes#
Used in unit tests for forming requests. |
class NonstrictMorphemeInDb#
- class tests.functional_tests.main.endpoints.fake_data.NonstrictMorphemeInDb(*, morpheme: str = None, type: Literal['prefix', 'root', 'suffix', 'link', None], word_pos: Literal['any', 'adjective', 'noun', 'verb'] = None, morpheme_id: int = None, family_id: int = None)[source]#
Bases:
pydantic.main.BaseModelUsed in unit tests for forming requests. Not all morpheme information is needed when making a request. This class lets us instantiate morphemes without needing all of the fields.
- classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model#
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
- copy(*, include: Union[AbstractSetIntStr, MappingIntStrAny] = None, exclude: Union[AbstractSetIntStr, MappingIntStrAny] = None, update: DictStrAny = None, deep: bool = False) Model#
Duplicate a model, optionally choose which fields to include, exclude and change.
- Parameters
include – fields to include in new model
exclude – fields to exclude from new model, as with values this takes precedence over include
update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data
deep – set to True to make a deep copy of the model
- Returns
new model instance
- dict(*, include: Union[AbstractSetIntStr, MappingIntStrAny] = None, exclude: Union[AbstractSetIntStr, MappingIntStrAny] = None, by_alias: bool = False, skip_defaults: bool = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny#
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- json(*, include: Union[AbstractSetIntStr, MappingIntStrAny] = None, exclude: Union[AbstractSetIntStr, MappingIntStrAny] = None, by_alias: bool = False, skip_defaults: bool = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode#
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
- classmethod update_forward_refs(**localns: Any) None#
Try to update ForwardRefs on fields based on this Model, globalns and localns.