code: def test_CpuResource():
      assert (
          CpuResource.from_system() > 0
      )  # TODO: real from_system tests
      with pytest.raises(BentoMLConfigException):
          CpuResource.validate(CpuResource.from_system() + 1)
      with pytest.raises(BentoMLConfigException):
          CpuResource.validate(-1)
  
      CpuResource.validate(0)
      CpuResource.validate(0.1)
      CpuResource.validate(1)
  
      assert math.isclose(CpuResource.from_spec("100m"), 0.1)
      assert math.isclose(CpuResource.from_spec(0.3), 0.3)
      assert math.isclose(CpuResource.from_spec(1), 1.0)
      assert math.isclose(CpuResource.from_spec("5"), 5.0)
  
      with pytest.raises(TypeError):
          CpuResource.from_spec((1, 2, 3))
  
file_path: BentoML/tests/unit/_internal/test_resource.py
imports: import math
  import pytest
  import bentoml
  import bentoml.exceptions
  from bentoml._internal.resource import CpuResource
  from bentoml._internal.resource import NvidiaGpuResource
  from bentoml._internal.resource import Resource
  from bentoml._internal.resource import get_resource
  from bentoml._internal.resource import system_resources
  from bentoml.exceptions import BentoMLConfigException
label_desc: Use image node_id 3 for calling a global function with example usage: test_CpuResource() without return types