code: def test_enum_class(self):
      # Check that invalid enum name raises exception.
      for invalid_name in ("a", "_A", "0"):
          try:
              EnumList(invalid_name)
          except AttributeError:
              pass
          else:
              raise Exception("EnumList with invalid name should fail.")
  
          try:
              EnumType(**{invalid_name: 0})
          except AttributeError:
              pass
          else:
              raise Exception("EnumType with invalid name should fail.")
  
      # Check that invalid enum value raises exception.
      try:
          EnumType(INVALID_VALUE="string is not allowed.")
      except TypeError:
          pass
      else:
          raise Exception("EnumType with invalid value should fail.")
  
      # Check EnumType.
      e1 = EnumType(C1=True, C2=12, C3=True, C4=-1, C5=False, C6=0.0)
      e2 = EnumType(C1=1, C2=12, C3=1, C4=-1.0, C5=0.0, C6=0)
      assert e1 == e2
      assert not (e1 != e2)
      assert hash(e1) == hash(e2)
      # Check access to attributes.
      assert (
          len((e1.ctype, e1.C1, e1.C2, e1.C3, e1.C4, e1.C5, e1.C6)) == 7
      )
  
      # Check enum with aliases.
      e1 = EnumType(A=("alpha", 0), B=("beta", 1), C=2)
      e2 = EnumType(A=("alpha", 0), B=("beta", 1), C=2)
      e3 = EnumType(A=("a", 0), B=("beta", 1), C=2)
      assert e1 == e2
      assert e1 != e3
      assert e1.filter("beta") == e1.fromalias("beta") == e1.B == 1
      assert e1.filter("C") == e1.fromalias("C") == e1.C == 2
  
      # Check that invalid alias (same as a constant) raises exception.
      try:
          EnumList(("A", "a"), ("B", "B"))
      except TypeError:
          EnumList(("A", "a"), ("B", "b"))
      else:
          raise Exception(
              "Enum with an alias name equal to a constant name should fail."
          )
  
imports: import os
  import numpy
  import pytest
  import pytensor
  from pytensor import scalar
  from pytensor.graph.basic import Apply
  from pytensor.link.c.op import COp
  from pytensor.link.c.type import CDataType, CEnumType, EnumList, EnumType
  from pytensor.tensor.type import TensorType, continuous_dtypes
label_desc: Use image node_id 1 for calling the TestEnumTypes obj's underlying member method code with example usage: obj.test_enum_class() without return types