def test_pagerank_none():
    drop_caches()
    with settings.file_override("PAGERANK"):
        with open(settings.PAGERANK, "wb") as f:
            pickle.dump({"dog": 2, "cat": 3}, f)
        assert set(SubstitutionFeaturesMixin._pagerank()) == {"dog", "cat"}
def test_pagerank_none_with_computed():
    drop_caches()
    # Lemmas are all lowercase.
    for word in SubstitutionFeaturesMixin._pagerank():
        assert word.islower() or is_int(word[0]) or is_int(word[-1]) or word in ["%", "!"]
def test_pagerank():
    drop_caches()
    assert abs(SubstitutionFeaturesMixin._pagerank("you") - 0.0006390798677378056) < 1e-15
    assert abs(SubstitutionFeaturesMixin._pagerank("play") - 0.0012008124120435305) < 1e-15
    assert np.isnan(SubstitutionFeaturesMixin._pagerank("wickiup"))