def get_value_source_resolver( schema: QuestionnaireSchema = None, answer_store: AnswerStore = AnswerStore(), list_store: ListStore = ListStore(), metadata: Optional[dict] = None, location: Union[Location, RelationshipLocation] = Location(section_id="test-section", block_id="test-block"), list_item_id: Optional[str] = None, routing_path_block_ids: Optional[list] = None, use_default_answer=False, escape_answer_values=False, ): if not schema: schema = get_mock_schema() schema.is_repeating_answer = Mock(return_value=bool(list_item_id)) if not use_default_answer: schema.get_default_answer = Mock(return_value=None) return ValueSourceResolver( answer_store=answer_store, list_store=list_store, metadata=metadata, schema=schema, location=location, list_item_id=list_item_id, routing_path_block_ids=routing_path_block_ids, use_default_answer=use_default_answer, escape_answer_values=escape_answer_values, )
def get_rule_evaluator( *, language="en", schema: QuestionnaireSchema = None, answer_store: AnswerStore = AnswerStore(), list_store: ListStore = ListStore(), metadata: Optional[dict] = None, response_metadata: Mapping = None, location: Union[Location, RelationshipLocation] = Location(section_id="test-section", block_id="test-block"), routing_path_block_ids: Optional[list] = None, ): if not schema: schema = get_mock_schema() schema.is_repeating_answer = Mock(return_value=True) schema.get_default_answer = Mock(return_value=None) return RuleEvaluator( language=language, schema=schema, metadata=metadata or {}, response_metadata=response_metadata, answer_store=answer_store, list_store=list_store, location=location, routing_path_block_ids=routing_path_block_ids, )