def METHOD_NAME(self, caplog: pytest.LogCaptureFixture) -> None:
    d = Document()
    dm = bdm.DocumentModuleManager(d)
    mod = FakeMod()
    assert 'FakeMod' not in sys.modules
    dm.add(mod)
    assert 'FakeMod' in sys.modules
    assert len(dm) == 1
    # add an extra referrer for Document.destroy to complain about
    extra.append(mod)
    import gc
    # get_referrers behavior changed in Python 3.7, see https://github.com/bokeh/bokeh/issues/8221
    assert len(gc.get_referrers(mod)) in (3,4)
    with caplog.at_level(logging.ERROR):
        dm.destroy()
        assert "Module %r has extra unexpected referrers! This could indicate a serious memory leak. Extra referrers:" % mod in caplog.text
        assert len(caplog.records) == 1
    assert 'FakeMod' not in sys.modules
    assert len(dm) ==0