code: def test_censored():
      df = pd.DataFrame(
          {
              "x": [1, 2, 3, 4, 5],
              "y": [2, 3, 4, 5, 6],
              "status": ["none", "right", "interval", "left", "none"],
          }
      )
  
      df_bad = pd.DataFrame({"x": [1, 2], "status": ["foo", "bar"]})
  
      x = censored(df["x"], df["status"])
      assert x.shape == (5, 2)
      assert (x[:, -1] == np.array([0, 1, 2, -1, 0])).all()
  
      x = censored(df["x"], df["y"], df["status"])
      assert x.shape == (5, 3)
      assert (x[:, -1] == np.array([0, 1, 2, -1, 0])).all()
  
      # Statuses are not the expected
      with pytest.raises(AssertionError, match="Statuses must be in"):
          censored(df_bad["x"], df_bad["status"])
  
      # Upper bound is not always larger than lower bound
      df_bad = pd.DataFrame(
          {"l": [1, 2], "r": [1, 1], "status": ["foo", "bar"]}
      )
  
      with pytest.raises(
          AssertionError,
          match="Upper bound must be larger than lower bound",
      ):
          censored(df_bad["l"], df_bad["r"], df_bad["status"])
  
      # Bad number of arguments
      with pytest.raises(
          ValueError, match="needs 2 or 3 argument values"
      ):
          censored(df["x"])
  
      with pytest.raises(
          ValueError, match="needs 2 or 3 argument values"
      ):
          censored(df["x"], df["x"], df["x"], df["x"])
  
file_path: bambi/tests/test_utils.py
imports: import pytest
  import numpy
  import pandas
  import pymc
  from bambi.utils import listify
  from bambi.backend.pymc import probit, cloglog
  from bambi.backend.utils import make_weighted_distribution
  from bambi.transformations import censored, constrained, truncated, weighted
label_desc: Use image node_id 4 for calling a global function with example usage: test_censored() without return types