code: def test_register():
      tracker = metrics_tracking.MetricsTracker()
      tracker.register("new_metric", direction="max")
      assert set(tracker.metrics.keys()) == {"new_metric"}
      assert tracker.metrics["new_metric"].direction == "max"
      with pytest.raises(
          ValueError, match="`direction` should be one of"
      ):
          tracker.register("another_metric", direction="wrong")
      with pytest.raises(ValueError, match="already exists"):
          tracker.register("new_metric", direction="max")
  
imports: import random
  import numpy
  import pytest
  from keras_tuner.backend.keras import losses
  from keras_tuner.backend.keras import metrics
  from keras_tuner.engine import metrics_tracking
label_desc: Use image node_id 2 for calling a global function with example usage: test_register() without return types