code: def test_union_type():
      wb_type = UnionType([float, str])
      assert wb_type.assign(1) == wb_type
      assert wb_type.assign("s") == wb_type
      assert wb_type.assign(True) == InvalidType()
  
      wb_type = UnionType([float, AnyType()])
      assert wb_type.assign(1) == wb_type
      assert wb_type.assign("s") == wb_type
      assert wb_type.assign(True) == wb_type
  
      wb_type = UnionType([float, UnknownType()])
      assert wb_type.assign(1) == wb_type
      assert wb_type.assign("s") == UnionType([float, StringType()])
      assert wb_type.assign(None) == InvalidType()
  
      wb_type = UnionType([float, OptionalType(UnknownType())])
      assert wb_type.assign(None).assign(True) == UnionType(
          [float, OptionalType(BooleanType())]
      )
  
      wb_type = UnionType([float, UnionType([str, UnknownType()])])
      assert wb_type.assign(1) == wb_type
      assert wb_type.assign("s") == wb_type
      assert wb_type.assign(True) == UnionType([float, str, bool])
      assert wb_type.assign(None) == InvalidType()
  
imports: import datetime
  import numpy
  import pytest
  import wandb
  from wandb import data_types
  from wandb.sdk.data_types._dtypes import AnyType, BooleanType, ConstType, InvalidType, ListType, NoneType, NumberType, OptionalType, StringType, TimestampType, TypedDictType, TypeRegistry, UnionType, UnknownType
label_desc: Use image node_id 9 for calling a global function with example usage: test_union_type() without return types