code: def assert_histogram(
      expected: facet_feature_statistics_pb2.Histogram,
      actual: facet_feature_statistics_pb2.Histogram,
  ):
      """
      Helper function to assert the actual histogram is almost equal to the expected histogram.
      """
      assert expected.type == actual.type
      assert len(expected.buckets) == len(actual.buckets)
      for act_bucket, exp_bucket in zip(
          actual.buckets, expected.buckets
      ):
          assert act_bucket.low_value == pytest.approx(
              exp_bucket.low_value, rel=1e-2
          )
          assert act_bucket.high_value == pytest.approx(
              exp_bucket.high_value, rel=1e-2
          )
          assert act_bucket.sample_count == pytest.approx(
              exp_bucket.sample_count, rel=1e-2
          )
  
file_path: mlflow/tests/recipes/cards/test_histogram_generator.py
imports: import pytest
  from google.protobuf import text_format
  from mlflow.protos import facet_feature_statistics_pb2
  from mlflow.recipes.cards import histogram_generator
label_desc: Use image node_id 1 for calling a global function with example usage: assert_histogram(expected, actual) without return types