code: def test_mutation(model0, mutator, max_pool, avg_pool, global_pool):
      model1 = mutator.apply(model0)
      assert _get_pools(model1) == (avg_pool, global_pool)
  
      model2 = mutator.apply(model1)
      assert _get_pools(model2) == (global_pool, max_pool)
  
      assert len(model2.history) == 2
      assert model2.history[0].from_ == model0
      assert model2.history[0].to == model1
      assert model2.history[1].from_ == model1
      assert model2.history[1].to == model2
      assert model2.history[0].mutator == mutator
      assert model2.history[1].mutator == mutator
  
      assert _get_pools(model0) == (max_pool, max_pool)
      assert _get_pools(model1) == (avg_pool, global_pool)
  
imports: import json
  from pathlib import Path
  import pytest
  from nni.common.framework import get_default_framework, set_default_framework
  from nni.nas.space import StationaryMutator, Mutator, MutationSampler, GraphModelSpace, ModelStatus, MutatorSequence
  from nni.nas.space.mutator import _RandomSampler
  from nni.nas.space.graph_op import Operation
label_desc: Use image node_id 9 for calling a global function with example usage: test_mutation(model0, mutator, max_pool, avg_pool, global_pool) without return types