def abi_string_to_text(type_str, data): if type_str == 'string': return type_str, text_if_str(to_text, data)
def test_text_if_str_on_text(val): to_type = Mock(return_value='zoot') assert text_if_str(to_type, val) == 'zoot' assert to_type.call_args == ((None, ), {'text': val})
def abi_string_to_text(type_str: TypeStr, data: Any) -> Optional[Tuple[TypeStr, str]]: if type_str == 'string': return type_str, text_if_str(to_text, data) return None
def test_text_if_str_passthrough(val): to_type = Mock(return_value='zoot') assert text_if_str(to_type, val) == 'zoot' assert to_type.call_args == ((val, ), {'text': None})
def abi_string_to_text(abi_type, data): if abi_type == 'string': return abi_type, text_if_str(to_text, data)