from goodnews.feeds import _img_from_html, parse_feed def test_img_from_html_finds_first_src(): assert _img_from_html('

hi

') == "https://x.com/a.jpg" assert _img_from_html("no images here") is None assert _img_from_html(None) is None RSS = b""" Storyhttps://e.com/1 lead

more]]>
NoImghttps://e.com/2just text
""" def test_parse_feed_pulls_image_from_content_html(): items = parse_feed(RSS) assert items[0].image_url == "https://e.com/photo.jpg" assert items[1].image_url is None # opportunistic: none when absent