code: def test_given_wrong_chain_when_validating_graph_then_report_violations():
      # chain: X->Y->Z
      true_dag = nx.DiGraph([("X", "Y"), ("Y", "Z")])
      dag = nx.DiGraph([("X", "Z"), ("Z", "Y")])
      X = np.random.normal(size=500)
      Y = 0.6 * X + np.random.normal(size=500)
      Z = Y + np.random.normal(size=500)
      data = pd.DataFrame(data=dict(X=X, Y=Y, Z=Z))
      summary = run_validations(
          dag,
          data,
          methods=(
              partial(
                  validate_lmc,
                  independence_test=_gcm_linear,
                  conditional_independence_test=_gcm_linear,
              ),
              partial(validate_pd, independence_test=_gcm_linear),
              partial(validate_tpa, causal_graph_reference=true_dag),
          ),
      )
  
      assert (
          summary[FalsifyConst.VALIDATE_LMC][FalsifyConst.N_VIOLATIONS]
          == 1
      )
      assert (
          summary[FalsifyConst.VALIDATE_LMC][FalsifyConst.N_TESTS] == 1
      )
      assert (
          summary[FalsifyConst.VALIDATE_PD][FalsifyConst.N_VIOLATIONS]
          == 0
      )
      assert (
          summary[FalsifyConst.VALIDATE_PD][FalsifyConst.N_TESTS] == 3
      )
      assert (
          summary[FalsifyConst.VALIDATE_TPA][FalsifyConst.N_VIOLATIONS]
          == 1
      )
      assert (
          summary[FalsifyConst.VALIDATE_TPA][FalsifyConst.N_TESTS] == 1
      )
  
imports: from functools import partial
  import networkx
  import numpy
  import pandas
  import pytest
  from flaky import flaky
  from dowhy.datasets import generate_random_graph
  from dowhy.gcm.falsify import FalsifyConst, _PermuteNodes, falsify_graph, run_validations, validate_cm, validate_lmc, validate_pd, validate_tpa
  from dowhy.gcm.independence_test.generalised_cov_measure import generalised_cov_based
  from dowhy.gcm.independence_test.kernel import kernel_based
  from dowhy.gcm.ml import create_linear_regressor
  from tests.gcm.independence_test.test_kernel import _generate_categorical_data
label_desc: Use image node_id 8 for calling a global function with example usage: test_given_wrong_chain_when_validating_graph_then_report_violations() without return types