def test_iso_to_wbtime_year_month(self): date = '2014-07' expected = pywikibot.WbTime(year=2014, month=7) self.assertEqual(iso_to_wbtime(date), expected)
def test_iso_to_wbtime_date(self): date = '2014-07-11' expected = pywikibot.WbTime(year=2014, month=7, day=11) self.assertEqual(iso_to_wbtime(date), expected)
def test_iso_to_wbtime_year(self): date = '2014' expected = pywikibot.WbTime(year=2014) self.assertEqual(iso_to_wbtime(date), expected)
def test_iso_to_wbtime_empty(self): with self.assertRaises(pywikibot.Error): iso_to_wbtime('')
def test_iso_to_wbtime_invalid_date(self): with self.assertRaises(pywikibot.Error): iso_to_wbtime('late 1980s')