code: def test_potentials():
      data = pd.DataFrame(np.repeat((0, 1), (18, 20)), columns=["w"])
      priors = {"Intercept": bmb.Prior("Uniform", lower=0, upper=1)}
  
      potentials = [
          (
              ("Intercept", "Intercept"),
              lambda x, y: bmb.math.switch(x < 0.45, y, -np.inf),
          ),
          (
              "Intercept",
              lambda x: bmb.math.switch(x > 0.55, 0, -np.inf),
          ),
      ]
  
      model = bmb.Model(
          "w ~ 1",
          data,
          family="bernoulli",
          link="identity",
          priors=priors,
          potentials=potentials,
      )
      model.build()
      assert len(model.backend.model.potentials) == 2
  
      pot0 = model.backend.model.potentials[0].get_parents()[0]
      pot1 = model.backend.model.potentials[1].get_parents()[0]
      assert pot0.__str__() == "Switch(Lt.0, Intercept, -inf)"
      assert pot1.__str__() == "Switch(Gt.0, 0, -inf)"
  
imports: import logging
  from functools import reduce
  from operator import add
  from os.path import dirname, join
  import arviz
  import numpy
  import pandas
  import pymc
  import pytest
  from formulae import design_matrices
  import bambi
  from bambi.terms import CommonTerm, GroupSpecificTerm
label_desc: Use image node_id 34 for calling a global function with example usage: test_potentials() without return types