def test_phonological_density_none():
    drop_caches()
    # Lemmas are all lowercase.
    for word in SubstitutionFeaturesMixin._phonological_density():
        assert word.islower()
    # And it's computed right.
    drop_caches()
    with settings.file_override("CLEARPOND"):
        with open(settings.CLEARPOND, "w") as f:
            f.write("dog" + 5 * "\t" + "2" + 24 * "\t" + "3\n" "cat" + 5 * "\t" + "2" + 24 * "\t" + "3")
        assert set(SubstitutionFeaturesMixin._phonological_density()) == {"dog", "cat"}
def test_phonological_density():
    drop_caches()
    assert SubstitutionFeaturesMixin._phonological_density("time") == 29
    assert np.isnan(SubstitutionFeaturesMixin._phonological_density("wickiup"))