def test_supported_fingerprinting(cls, monkeypatch): # patch so we can instantiate various solvers without the proper libraries monkeypatch.setitem(sys.modules, "scipy", Mock()) monkeypatch.setitem(sys.modules, "scipy.optimize", Mock()) monkeypatch.setitem(sys.modules, "sklearn", Mock()) monkeypatch.setitem(sys.modules, "sklearn.linear_model", Mock()) monkeypatch.setitem(sys.modules, "sklearn.utils", Mock()) monkeypatch.setitem(sys.modules, "sklearn.utils.extmath", Mock()) obj = cls() assert Fingerprint.supports(obj) # check fingerprint is created without error and is a valid sha1 hash fp = str(Fingerprint(obj)) assert len(fp) == 40 and set(fp).issubset("0123456789abcdef")
def test_supported_fingerprinting(cls, monkeypatch): # patch so we can instantiate various solvers without the proper libraries monkeypatch.setitem(sys.modules, "scipy", Mock()) monkeypatch.setitem(sys.modules, "scipy.optimize", Mock()) monkeypatch.setitem(sys.modules, "sklearn", Mock()) monkeypatch.setitem(sys.modules, "sklearn.linear_model", Mock()) monkeypatch.setitem(sys.modules, "sklearn.utils", Mock()) monkeypatch.setitem(sys.modules, "sklearn.utils.extmath", Mock()) args = [] if issubclass(cls, nengo.neurons.RatesToSpikesNeuronType): # spiking types require a `base_type` argument, so provide one args.append(nengo.neurons.RectifiedLinear()) obj = cls(*args) assert Fingerprint.supports(obj) # check fingerprint is created without error and is a valid sha1 hash fp = str(Fingerprint(obj)) assert len(fp) == 40 and set(fp).issubset("0123456789abcdef")