code: def test_inheritance_and_len():
      class A(eqxi.Enumeration):
          a = "foo"
  
      class B(eqxi.Enumeration):
          b = "bar"
  
      class C1(A, B):  # pyright: ignore
          c = "qux"
  
      class C2(B, A):  # pyright: ignore
          c = "qux"
  
      class D1(C1, A):  # pyright: ignore
          d = "quux"
  
      class D2(C2, A):  # pyright: ignore
          d = "quux"
  
      with pytest.raises(Exception):
  
          class D3(A, C1):  # pyright: ignore
              d = "quux"
  
      with pytest.raises(Exception):
  
          class D4(A, C2):  # pyright: ignore
              d = "quux"
  
      A.a
      B.b
      C1.a
      C1.b
      C1.c
      C2.a
      C2.b
      C2.c
      D1.a
      D1.b
      D1.c
      D1.d
      D2.a
      D2.b
      D2.c
      D2.d
  
      with pytest.raises(ValueError):
          D1.a == A.a  # pyright: ignore
  
      with pytest.raises(ValueError):
          D1.d == A.a  # pyright: ignore
  
      assert C1.promote(A.a) == C1.a
      assert C2.promote(A.a) == C2.a
      assert C1.promote(B.b) == C1.b
      assert C2.promote(B.b) == C2.b
  
      with pytest.raises(ValueError):
          C1.promote(C1.c)
  
      with pytest.raises(ValueError):
          C1.promote(C2.c)
  
      assert D1.promote(A.a) == D1.a
      assert D1.promote(B.b) == D1.b
      assert D1.promote(C1.a) == D1.a
      assert D1.promote(C1.b) == D1.b
      assert D1.promote(C1.c) == D1.c
  
      assert D2.promote(A.a) == D2.a
      assert D2.promote(B.b) == D2.b
      assert D2.promote(C2.a) == D2.a
      assert D2.promote(C2.b) == D2.b
      assert D2.promote(C2.c) == D2.c
  
      assert C1.promote(B.b) != C1.a
      assert D2.promote(A.a) != D2.b
  
      assert len(A) == 1
      assert len(B) == 1
      assert len(C1) == 3
      assert len(C2) == 3
      assert len(D1) == 4
      assert len(D2) == 4
  
file_path: equinox/tests/test_enum.py
imports: import equinox
  import equinox.internal
  import jax
  import jax.numpy
  import jax.tree_util
  import pytest
  from .helpers import tree_allclose
label_desc: Use image node_id 4 for calling a global function with example usage: test_inheritance_and_len() without return types