code: def test_assign_other_raises(self):
      def new_trait_class(case_sensitive, substring_matching):
          class Example(HasTraits):
              color = FuzzyEnum(
                  color_choices,
                  case_sensitive=case_sensitive,
                  substring_matching=substring_matching,
              )
  
          return Example
  
      example = new_trait_class(
          case_sensitive=False, substring_matching=False
      )()
      with self.assertRaises(TraitError):
          example.color = ""
      with self.assertRaises(TraitError):
          example.color = "BAD COLOR"
      with self.assertRaises(TraitError):
          example.color = "ed"
  
      example = new_trait_class(
          case_sensitive=True, substring_matching=False
      )()
      with self.assertRaises(TraitError):
          example.color = ""
      with self.assertRaises(TraitError):
          example.color = "Red"  # not 'red'
  
      example = new_trait_class(
          case_sensitive=True, substring_matching=True
      )()
      with self.assertRaises(TraitError):
          example.color = ""
      with self.assertRaises(TraitError):
          example.color = "BAD COLOR"
      with self.assertRaises(TraitError):
          example.color = "green"  # not 'Green'
      with self.assertRaises(TraitError):
          example.color = "lue"  # not (b)'LUE'
      with self.assertRaises(TraitError):
          example.color = "lUE"  # not (b)'LUE'
  
      example = new_trait_class(
          case_sensitive=False, substring_matching=True
      )()
      with self.assertRaises(TraitError):
          example.color = ""
      with self.assertRaises(TraitError):
          example.color = "BAD COLOR"
  
imports: import enum
  import unittest
  from traitlets import CaselessStrEnum, Enum, FuzzyEnum, HasTraits, TraitError, UseEnum
label_desc: Use image node_id 5 for calling the TestFuzzyEnum obj's underlying member method code with example usage: obj.test_assign_other_raises() and returns: Example