def find_date(html: str, url: str) -> datetime_date: """Return the date of the document.""" # Example for find_any_date(url): # http://ftalphaville.ft.com/2012/05/16/1002861/recap-and-tranche-primer/?Authorised=false # Example for find_any_date(html): # https://www.bbc.com/news/uk-england-25462900 m = DATE_SEARCH(html) return find_any_date(m) if m else find_any_date(url) or find_any_date(html)
def test_arabic_ya(self): self.assertEqual( find_any_date('تاریخ انتشار : جمعه ۳ ارديبهشت ۱۳۸۹ ساعت ۱۶:۴۸'), date(2010, 4, 23))
def test_arabic_ya(): assert find_any_date('تاریخ انتشار : جمعه ۳ ارديبهشت ۱۳۸۹ ساعت ۱۶:۴۸') == \ date(2010, 4, 23)