def test_DWPWL_empty(tmp_path): """Test functionality of DictWithPWL using transient dicts.""" d = DictWithPWL("en_US", None, None) assert d.check("hello") assert not d.check("helo") assert not d.check("Flagen") d.add("Flagen") assert d.check("Flagen") d.remove("hello") assert not d.check("hello") d.add("hello") assert d.check("hello")
def test_DWPWL(tmp_path, pwl_path): """Test functionality of DictWithPWL.""" setPWLContents(pwl_path, ["Sazz", "Lozz"]) other_path = tmp_path / "pel.txt" d = DictWithPWL("en_US", str(pwl_path), str(other_path)) assert d.check("Sazz") assert d.check("Lozz") assert d.check("hello") assert not d.check("helo") assert not d.check("Flagen") d.add("Flagen") assert d.check("Flagen") assert "Flagen" in getPWLContents(pwl_path) assert "Flagen" in d.suggest("Flagn") assert "hello" in d.suggest("helo") d.remove("hello") assert not d.check("hello") assert "hello" not in d.suggest("helo") d.remove("Lozz") assert not d.check("Lozz")