class_docstr: Tests the ColorPalette object
docstr: Test that a palette can be initialized by name
docstr_tok: ["Test","that","a","palette","can","be","initialized","by","name"]
code: def test_init_palette_by_name(self):
      """
      Test that a palette can be initialized by name
      """
  
      # Try all the names in the palettes
      for name, value in PALETTES.items():
          try:
              palette = ColorPalette(name)
          except YellowbrickValueError:
              self.fail(
                  "Could not instantiate {} color palette by name".format(
                      name
                  )
              )
  
          assert value == palette
  
      # Try a name not in PALETTES
      with pytest.raises(YellowbrickValueError):
          assert (
              "foo" not in PALETTES
          ), "Cannot test bad name 'foo' it is in PALETTES!"
          palette = ColorPalette("foo")
  
imports: import pytest
  import numpy
  import matplotlib
  from yellowbrick.exceptions import *
  from yellowbrick.style.palettes import *
  from yellowbrick.style.colors import get_color_cycle
  from yellowbrick.style.rcmod import set_aesthetic, set_palette
  from yellowbrick.style.palettes import color_sequence, color_palette
  from yellowbrick.style.palettes import ColorPalette, PALETTES, SEQUENCES
  from tests.base import VisualTestCase
label_desc: Use image node_id 1 for calling the TestColorPaletteObject obj's underlying member method code with example usage: obj.test_init_palette_by_name() without return types