Ejemplo n.º 1
0
def test_dispose_extension():
    binalyzer = Binalyzer()
    binalyzer.extensions = {}
    mock = MockExtension(binalyzer)
    assert binalyzer.has_extension("mock")
    assert len(binalyzer.extensions) == 1
    assert isinstance(binalyzer.extensions["mock"], MockExtension)
    assert id(mock) == id(binalyzer.extension("mock"))
    binalyzer.del_extension("mock")
    assert not binalyzer.has_extension("mock")
    assert len(binalyzer.extensions) == 0
    assert mock.disposed
Ejemplo n.º 2
0
def test_del_non_existent_extension():
    binalyzer = Binalyzer()
    with pytest.raises(RuntimeError):
        binalyzer.del_extension("mock")