code: def test_amp_precision_plugin_parameter_validation():
      MixedPrecision("16-mixed", "cpu")  # should not raise exception
      MixedPrecision("bf16-mixed", "cpu")
  
      with pytest.raises(
          ValueError,
          match=re.escape(
              "Passed `MixedPrecision(precision='16')`. Precision must be '16-mixed' or 'bf16-mixed'"
          ),
      ):
          MixedPrecision("16", "cpu")
  
      with pytest.raises(
          ValueError,
          match=re.escape(
              "Passed `MixedPrecision(precision=16)`. Precision must be '16-mixed' or 'bf16-mixed'"
          ),
      ):
          MixedPrecision(16, "cpu")
  
      with pytest.raises(
          ValueError,
          match=re.escape(
              "Passed `MixedPrecision(precision='bf16')`. Precision must be '16-mixed' or 'bf16-mixed'"
          ),
      ):
          MixedPrecision("bf16", "cpu")
  
imports: import os
  import re
  from unittest import mock
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.plugins import MixedPrecision
  from torch import Tensor
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 5 for calling a global function with example usage: test_amp_precision_plugin_parameter_validation() without return types