from goodnews.paywall import is_paywalled def test_known_paywalls_flagged(): assert is_paywalled("https://www.newscientist.com/article/x") assert is_paywalled("https://www.nature.com/articles/d41586") assert is_paywalled("https://news.nature.com/foo") # subdomain assert is_paywalled("https://www.nytimes.com/2026/05/31/x") def test_free_domains_not_flagged(): assert not is_paywalled("https://www.theguardian.com/x") assert not is_paywalled("https://phys.org/news/x") assert not is_paywalled("https://www.goodnewsnetwork.org/x") assert not is_paywalled(None) assert not is_paywalled("")