def test_degree_none():
    drop_caches()
    with settings.file_override("DEGREE"):
        with open(settings.DEGREE, "wb") as f:
            pickle.dump({"dog": 2, "cat": 3}, f)
        assert set(SubstitutionFeaturesMixin._degree()) == {"dog", "cat"}
def test_degree_none_with_computed():
    drop_caches()
    # Lemmas are all lowercase.
    for word in SubstitutionFeaturesMixin._degree():
        assert word.islower() or is_int(word[0]) or is_int(word[-1]) or word in ["%", "!"]
def test_degree():
    drop_caches()
    assert SubstitutionFeaturesMixin._degree("abdomen") == 1 / (10617 - 1)
    assert SubstitutionFeaturesMixin._degree("speaker") == 9 / (10617 - 1)
    assert np.isnan(SubstitutionFeaturesMixin._degree("wickiup"))