From d844528c5f62f27904d6925f16cc7d1ee3e16949 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Fri, 22 May 2020 16:55:15 +0200 Subject: [PATCH] Add test for is_compatible_model --- spacy/tests/test_misc.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spacy/tests/test_misc.py b/spacy/tests/test_misc.py index c320b19c0..0a0f4c7be 100644 --- a/spacy/tests/test_misc.py +++ b/spacy/tests/test_misc.py @@ -2,6 +2,7 @@ import pytest import os import ctypes from pathlib import Path +from spacy.about import __version__ as spacy_version from spacy import util from spacy import prefer_gpu, require_gpu from spacy.ml._precomputable_affine import PrecomputableAffine, _backprop_precomputable_affine_padding @@ -87,3 +88,11 @@ def test_ascii_filenames(): root = Path(__file__).parent.parent for path in root.glob("**/*"): assert all(ord(c) < 128 for c in path.name), path.name + + +@pytest.mark.parametrize( + "version,compatible", + [(spacy_version, True), ("2.0.0", False), (">=1.2.3,<4.5.6", False)], +) +def test_is_compatible_model(version, compatible): + assert util.is_compatible_model({"spacy_version": version}) is compatible