def test_add_extension(): mock = MockExtension(None) binalyzer = Binalyzer() binalyzer.extensions = {} binalyzer.add_extension("mock", mock) assert binalyzer.has_extension("mock") assert len(binalyzer.extensions) == 1 assert isinstance(binalyzer.extensions["mock"], MockExtension) assert id(mock) == id(binalyzer.extension("mock")) assert id(mock) == id(binalyzer.mock)
def test_add_extension_twice(): binalyzer = Binalyzer() mock = MockExtension(None) binalyzer.add_extension("mock", mock) with pytest.raises(RuntimeError): binalyzer.add_extension("mock", mock)