code: def test_broken_repr(self, pytester: Pytester) -> None:
      p = pytester.makepyfile(
          """
              import pytest
  
              class reprexc(BaseException):
                  def __str__(self):
                      return "Ha Ha fooled you, I'm a broken repr()."
  
              class BrokenRepr1(object):
                  foo=0
                  def __repr__(self):
                      raise reprexc
  
              class TestBrokenClass(object):
                  def test_explicit_bad_repr(self):
                      t = BrokenRepr1()
                      with pytest.raises(BaseException, match="broken repr"):
                          repr(t)
  
                  def test_implicit_bad_repr1(self):
                      t = BrokenRepr1()
                      assert t.foo == 1
  
          """
      )
      reprec = pytester.inline_run(p)
      passed, skipped, failed = reprec.listoutcomes()
      assert (len(passed), len(skipped), len(failed)) == (1, 0, 1)
      out = failed[0].longrepr.reprcrash.message  # type: ignore[union-attr]
      assert out.find("<[reprexc() raised in repr()] BrokenRepr1") != -1
  
imports: import pytest
  from _pytest.config import ExitCode
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.pytester import Pytester
label_desc: Use image node_id 7 for calling the SessionTests obj's underlying member method code with example usage: obj.test_broken_repr(pytester) without return types