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 test_infer_sdk_type_from_literal(): o = _type_helpers.infer_sdk_type_from_literal( _literals.Literal(scalar=_literals.Scalar( primitive=_literals.Primitive(string_value="abc")))) assert o == _sdk_types.Types.String o = _type_helpers.infer_sdk_type_from_literal( _literals.Literal(scalar=_literals.Scalar(none_type=_literals.Void()))) assert o is _base_sdk_types.Void
def test_scalar_void(): obj = literals.Scalar(none_type=literals.Void()) assert obj.primitive is None assert obj.error is None assert obj.blob is None assert obj.binary is None assert obj.schema is None assert obj.none_type is not None obj2 = literals.Scalar.from_flyte_idl(obj.to_flyte_idl()) assert obj2 == obj assert obj2.primitive is None assert obj2.error is None assert obj2.blob is None assert obj2.binary is None assert obj2.schema is None assert obj2.none_type is not None
def __init__(self): super(Void, self).__init__(scalar=_literal_models.Scalar( none_type=_literal_models.Void()))
def test_void(): obj = literals.Void() assert literals.Void.from_flyte_idl(obj.to_flyte_idl()) == obj assert literals.Void() == obj
] LIST_OF_TASK_CLOSURES = [ task.TaskClosure(task.CompiledTask(template)) for template in LIST_OF_TASK_TEMPLATES ] LIST_OF_SCALARS_AND_PYTHON_VALUES = [ (literals.Scalar(primitive=literals.Primitive(integer=100)), 100), (literals.Scalar(primitive=literals.Primitive(float_value=500.0)), 500.0), (literals.Scalar(primitive=literals.Primitive(boolean=True)), True), (literals.Scalar(primitive=literals.Primitive(string_value='hello')), 'hello'), (literals.Scalar(primitive=literals.Primitive(duration=timedelta( seconds=5))), timedelta(seconds=5)), (literals.Scalar(none_type=literals.Void()), None), (literals.Scalar(blob=literals.Blob( literals.BlobMetadata( _core_types.BlobType( "csv", _core_types.BlobType.BlobDimensionality.SINGLE)), "s3://some/where")), _blob_impl.Blob("s3://some/where", format="csv")), (literals.Scalar(blob=literals.Blob( literals.BlobMetadata( _core_types.BlobType( "", _core_types.BlobType.BlobDimensionality.SINGLE)), "s3://some/where")), _blob_impl.Blob("s3://some/where")), (literals.Scalar(blob=literals.Blob( literals.BlobMetadata( _core_types.BlobType( "csv", _core_types.BlobType.BlobDimensionality.MULTIPART)), "s3://some/where/")),