code: def test_pruning_misconfiguration():
      with pytest.raises(
          MisconfigurationException,
          match=r"chocolate isn't in \('weight', 'bias'\)",
      ):
          ModelPruning(
              pruning_fn="l1_unstructured",
              parameter_names=["chocolate"],
          )
      with pytest.raises(
          MisconfigurationException, match=r"expected to be a str in \["
      ):
          ModelPruning(pruning_fn={})
      with pytest.raises(
          MisconfigurationException, match="should be provided"
      ):
          ModelPruning(pruning_fn="random_structured")
      with pytest.raises(
          MisconfigurationException, match=r"must be any of \(0, 1, 2\)"
      ):
          ModelPruning(pruning_fn="l1_unstructured", verbose=3)
      with pytest.raises(
          MisconfigurationException,
          match="requesting `ln_structured` pruning, the `pruning_norm`",
      ):
          ModelPruning(pruning_fn="ln_structured", pruning_dim=0)
  
imports: import re
  from collections import OrderedDict
  from logging import INFO
  from typing import Union
  import pytest
  import torch
  import torch.nn.utils.prune
  from lightning.pytorch import Trainer, seed_everything
  from lightning.pytorch.callbacks import ModelCheckpoint, ModelPruning
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from torch import nn
  from torch.nn import Sequential
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 2 for calling a global function with example usage: test_pruning_misconfiguration() without return types