code: def test_encode_scalar_float():
      codec = ScalarCodec(FloatType())
      expected = np.random.random(()).astype(np.float64)
      field = UnischemaField(
          name="field_float",
          numpy_dtype=np.float32,
          shape=(),
          codec=codec,
          nullable=False,
      )
      encoded = codec.encode(field, expected)
      assert isinstance(encoded, float)
      assert expected == encoded
  
file_path: petastorm/petastorm/tests/test_codec_scalar.py
imports: from decimal import Decimal
  import numpy
  import pytest
  from pyspark.sql.types import StringType, ByteType, ShortType, IntegerType, LongType, DecimalType, BooleanType, FloatType
  from petastorm.codecs import ScalarCodec
  from petastorm.unischema import UnischemaField
label_desc: Use image node_id 9 for calling a global function with example usage: test_encode_scalar_float() without return types