code: def test_calculate_batch_sizes() -> None:
      # Valid cases.
      psbs, gbs = det.util.calculate_batch_sizes(
          {"global_batch_size": 1}, 1, "Trial"
      )
      assert (psbs, gbs) == (1, 1)
      psbs, gbs = det.util.calculate_batch_sizes(
          {"global_batch_size": 8}, 2, "Trial"
      )
      assert (psbs, gbs) == (4, 8)
  
      # Missing global_batch_size.
      with pytest.raises(
          det.errors.InvalidExperimentException,
          match="is a required hyperparameter",
      ):
          det.util.calculate_batch_sizes({}, 1, "Trial")
  
      # Invalid global_batch_size.
      for x in ["1", 32.0]:
          with pytest.raises(
              det.errors.InvalidExperimentException,
              match="must be an integer value",
          ):
              det.util.calculate_batch_sizes(
                  {"global_batch_size": x}, 1, "Trial"
              )
  
      # global_batch_size too small.
      with pytest.raises(
          det.errors.InvalidExperimentException,
          match="to be greater or equal",
      ):
          det.util.calculate_batch_sizes(
              {"global_batch_size": 1}, 2, "Trial"
          )
  
file_path: determined/harness/tests/test_util.py
imports: import os
  import pathlib
  from typing import Optional
  import numpy
  import pytest
  import determined
  from determined import util
  from tests import filetree
label_desc: Use image node_id 4 for calling a global function with example usage: test_calculate_batch_sizes() without return types