code: def test_json_encoder_dataclass_like():
      expected = '{"name":"test","endpoints":["predict","health"]}'
      assert (
          dumps(
              ExampleDataclass(
                  name="test", endpoints=["predict", "health"]
              )
          )
          == expected
      )
      assert (
          dumps(
              BaseSchema(name="test", endpoints=["predict", "health"])
          )
          == expected
      )
      assert (
          dumps(
              ExampleAttrsClass(
                  name="test", endpoints=["predict", "health"]
              )
          )
          == expected
      )
  
      assert (
          dumps(
              Nested(
                  toplevel="test",
                  nested=BaseSchema(
                      name="test", endpoints=["predict", "health"]
                  ),
              )
          )
          == '{"toplevel":"test","nested":{"name":"test","endpoints":["predict","health"]}}'
      )
  
imports: from __future__ import annotations
  import asyncio
  import json
  import logging
  import typing
  from dataclasses import dataclass
  from functools import partial
  from typing import TYPE_CHECKING
  import attr
  import numpy
  import pandas
  import pydantic
  import pytest
  from bentoml._internal.io_descriptors.json import DefaultJsonEncoder
  from bentoml._internal.utils import LazyLoader
  from bentoml.exceptions import BadInput
  from bentoml.grpc.utils import import_generated_stubs
  from bentoml.io import JSON
label_desc: Use image node_id 3 for calling a global function with example usage: test_json_encoder_dataclass_like() without return types