def test_get_sdk_value_from_literal(): o = _type_helpers.get_sdk_value_from_literal( _literals.Literal(scalar=_literals.Scalar(none_type=_literals.Void()))) assert o.to_python_std() is None o = _type_helpers.get_sdk_value_from_literal( _literals.Literal(scalar=_literals.Scalar(none_type=_literals.Void())), sdk_type=_sdk_types.Types.Integer, ) assert o.to_python_std() is None o = _type_helpers.get_sdk_value_from_literal( _literals.Literal(scalar=_literals.Scalar( primitive=_literals.Primitive(integer=1))), sdk_type=_sdk_types.Types.Integer, ) assert o.to_python_std() == 1 o = _type_helpers.get_sdk_value_from_literal( _literals.Literal(collection=_literals.LiteralCollection([ _literals.Literal(scalar=_literals.Scalar( primitive=_literals.Primitive(integer=1))), _literals.Literal(scalar=_literals.Scalar( none_type=_literals.Void())), ]))) assert o.to_python_std() == [1, None]
def _transform_for_user_output(self, outputs): """ Just return the outputs as a user-readable dictionary. :param dict[Text,flytekit.models.common.FlyteIdlEntity] outputs: :rtype: T """ literal_map = outputs[_sdk_constants.OUTPUT_FILE_NAME] return { name: _type_helpers.get_sdk_value_from_literal( literal_map.literals[name], sdk_type=_type_helpers.get_sdk_type_from_literal_type(variable.type), ).to_python_std() for name, variable in _six.iteritems(self.sdk_task.interface.outputs) }