def test_range_partadbc(self): rng = just_ranges("Jesus was born somewhere in 7-4 BC") self.assertEqual(rng, [((0, 0, -7), (0, 0, -4))])
def test_present(self): rng = just_ranges("I will stay from July the 20th until today") self.assertEqual(rng[0][0], (20, 7, 0))
def test_range_incoherent(self): rng = just_ranges( "I will be here from 30th of september 2006 to 18.7.2007") self.assertEqual(rng, [((30, 9, 2006), (18, 7, 2007))])
def test_range(self): rng = just_ranges(u"I will be there from 2008 to 2009") self.assertEqual(rng, [((0, 0, 2008), (0, 0, 2009))]) rng = just_ranges(u"c. 2001–2002") self.assertEqual(rng, [((0, 0, 2001), (0, 0, 2002))])
def tr(self, text, dates): res = just_ranges(text) self.assertEqual(res, dates, "Text: '%s'" % text)
def test_mozzart_regression(self): date = u'German: [\u02c8v\u0254lf\u0261a\u014b ama\u02c8de\u02d0\u028as \u02c8mo\u02d0tsa\u0281t], English see fn.;[1] 27 January 1756\xa0\u2013 5 December 1791' dates = just_ranges(date) self.assertEqual(dates, [((27, 1, 1756), (5, 12, 1791))])