Lines Matching full:theclass
133 # Subclasses must define 'theclass', and theclass(1, 1, 1) must be a
137 me = self.theclass(1, 1, 1)
148 me = self.theclass(1, 1, 1)
168 theclass = timedelta
538 theclass = date
541 dt = self.theclass(2002, 3, 1)
547 for dt in (self.theclass(1, 2, 3),
548 self.theclass.today()):
557 dt2 = self.theclass(dt.year, dt.month, dt.day)
567 d = self.theclass(y, m, d)
569 fromord = self.theclass.fromordinal(n)
583 d = self.theclass(year, 1, 1)
585 d2 = self.theclass.fromordinal(n)
589 d = self.theclass.fromordinal(n-1)
590 d2 = self.theclass(year-1, 12, 31)
597 n = self.theclass(year, 1, 1).toordinal()
602 d = self.theclass(year, month, day)
604 self.assertEqual(d, self.theclass.fromordinal(n))
608 a = self.theclass.min
609 a = self.theclass(a.year, a.month, a.day) # get rid of time parts
618 self.assertEqual(b, self.theclass.fromordinal(aord + 1))
620 a = self.theclass.max
621 a = self.theclass(a.year, a.month, a.day) # get rid of time parts
630 self.assertEqual(b, self.theclass.fromordinal(aord - 1))
634 self.theclass(MINYEAR, 1, 1) # no exception
635 self.theclass(MAXYEAR, 1, 1) # no exception
636 self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
637 self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
639 self.theclass(2000, 1, 1) # no exception
640 self.theclass(2000, 12, 1) # no exception
641 self.assertRaises(ValueError, self.theclass, 2000, 0, 1)
642 self.assertRaises(ValueError, self.theclass, 2000, 13, 1)
644 self.theclass(2000, 2, 29) # no exception
645 self.theclass(2004, 2, 29) # no exception
646 self.theclass(2400, 2, 29) # no exception
647 self.assertRaises(ValueError, self.theclass, 2000, 2, 30)
648 self.assertRaises(ValueError, self.theclass, 2001, 2, 29)
649 self.assertRaises(ValueError, self.theclass, 2100, 2, 29)
650 self.assertRaises(ValueError, self.theclass, 1900, 2, 29)
651 self.assertRaises(ValueError, self.theclass, 2000, 1, 0)
652 self.assertRaises(ValueError, self.theclass, 2000, 1, 32)
655 d = self.theclass(2000, 12, 31)
657 e = self.theclass(2000, 12, 31)
667 d = self.theclass(2001, 1, 1)
669 e = self.theclass(2001, 1, 1)
680 a = self.theclass(2002, 1, 31)
681 b = self.theclass(1956, 1, 31)
690 a = self.theclass(2002, 3, 2)
691 self.assertEqual(a + day, self.theclass(2002, 3, 3))
692 self.assertEqual(day + a, self.theclass(2002, 3, 3))
693 self.assertEqual(a - day, self.theclass(2002, 3, 1))
694 self.assertEqual(-day + a, self.theclass(2002, 3, 1))
695 self.assertEqual(a + week, self.theclass(2002, 3, 9))
696 self.assertEqual(a - week, self.theclass(2002, 2, 23))
697 self.assertEqual(a + 52*week, self.theclass(2003, 3, 1))
698 self.assertEqual(a - 52*week, self.theclass(2001, 3, 3))
728 tiny = self.theclass.resolution
731 dt = self.theclass.min + delta
736 dt = self.theclass.max - delta
747 d = self.theclass.fromtimestamp(ts)
758 self.assertRaises(ValueError, self.theclass.fromtimestamp,
767 today = self.theclass.today()
769 todayagain = self.theclass.fromtimestamp(ts)
792 self.assertEqual(self.theclass(2002, 3, 4+i).weekday(), i)
793 self.assertEqual(self.theclass(2002, 3, 4+i).isoweekday(), i+1)
795 self.assertEqual(self.theclass(1956, 1, 2+i).weekday(), i)
796 self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1)
802 d = self.theclass(2003, 12, 22+i)
804 d = self.theclass(2003, 12, 29) + timedelta(i)
806 d = self.theclass(2004, 1, 5+i)
808 d = self.theclass(2009, 12, 21+i)
810 d = self.theclass(2009, 12, 28) + timedelta(i)
812 d = self.theclass(2010, 1, 4+i)
847 d = self.theclass(2000+i, 12, 31)
848 d1 = self.theclass(1600+i, 12, 31)
855 t = self.theclass(2, 3, 2)
859 t = self.theclass(2002, 3, 2)
863 t = self.theclass(2005, 3, 2)
897 dt = self.theclass(2007, 9, 10)
901 class A(self.theclass):
908 class B(self.theclass):
923 self.assertIsInstance(self.theclass.min, self.theclass)
924 self.assertIsInstance(self.theclass.max, self.theclass)
925 self.assertIsInstance(self.theclass.resolution, timedelta)
926 self.assertTrue(self.theclass.max > self.theclass.min)
929 big = self.theclass.max - self.theclass.min
935 self.assertEqual(self.theclass.min + big, self.theclass.max)
936 self.assertEqual(self.theclass.max - big, self.theclass.min)
941 d = self.theclass(1956, 1, 2+i)
945 d = self.theclass(1956, 2, 1+i)
950 d = self.theclass(1956, 3, 1+i)
965 orig = self.theclass(*args)
972 t1 = self.theclass(2, 3, 4)
973 t2 = self.theclass(2, 3, 4)
984 t2 = self.theclass(*args) # this is larger than t1
1015 our = self.theclass(2000, 4, 5)
1055 self.assertTrue(self.theclass.min)
1056 self.assertTrue(self.theclass.max)
1060 cls = self.theclass
1066 cls = self.theclass
1088 class C(self.theclass):
1094 result = self.theclass.__new__(cls, *args, **temp)
1103 dt1 = self.theclass(*args)
1131 if not issubclass(self.theclass, datetime):
1134 self.assertRaises(TypeError, self.theclass,
1140 self.theclass(base[:2] + chr(ord_byte) + base[3:])
1150 theclass = datetime
1153 dt = self.theclass(2002, 3, 1, 12, 0)
1165 dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000)
1175 for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7),
1176 self.theclass.now()):
1185 dt2 = self.theclass(dt.year, dt.month, dt.day,
1191 t = self.theclass(2, 3, 2, 4, 5, 1, 123)
1199 t = self.theclass(2, 3, 2)
1207 dt = self.theclass(2007, 9, 10, 4, 5, 1, 123)
1211 class A(self.theclass):
1218 class B(self.theclass):
1236 t = self.theclass(2002, 3, 2, 18, 3, 5, 123)
1245 t = self.theclass(2002, 3, 22, 18, 3, 5, 123)
1249 dt1 = self.theclass(2002, 3, 1, 9, 0, 0)
1250 dt2 = self.theclass(2002, 3, 1, 10, 0, 0)
1251 dt3 = self.theclass(2002, 3, 1, 9, 0, 0)
1260 dt1 = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999998)
1274 t = self.theclass(2005, 3, 2, 0, 0, 0, 0, MyTzInfo(3, 'name'))
1279 theclass(MINYEAR, 1, 1) # no exception
1280 self.theclass(MAXYEAR, 1, 1) # no exception
1281 self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1)
1282 self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1)
1284 self.theclass(2000, 1, 1) # no exception
1285 self.theclass(2000, 12, 1) # no exception
1286 self.assertRaises(ValueError, self.theclass, 2000, 0, 1)
1287 self.assertRaises(ValueError, self.theclass, 2000, 13, 1)
1289 self.theclass(2000, 2, 29) # no exception
1290 self.theclass(2004, 2, 29) # no exception
1291 self.theclass(2400, 2, 29) # no exception
1292 self.assertRaises(ValueError, self.theclass, 2000, 2, 30)
1293 self.assertRaises(ValueError, self.theclass, 2001, 2, 29)
1294 self.assertRaises(ValueError, self.theclass, 2100, 2, 29)
1295 self.assertRaises(ValueError, self.theclass, 1900, 2, 29)
1296 self.assertRaises(ValueError, self.theclass, 2000, 1, 0)
1297 self.assertRaises(ValueError, self.theclass, 2000, 1, 32)
1299 self.theclass(2000, 1, 31, 0) # no exception
1300 self.theclass(2000, 1, 31, 23) # no exception
1301 self.assertRaises(ValueError, self.theclass, 2000, 1, 31, -1)
1302 self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 24)
1304 self.theclass(2000, 1, 31, 23, 0) # no exception
1305 self.theclass(2000, 1, 31, 23, 59) # no exception
1306 self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, -1)
1307 self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 60)
1309 self.theclass(2000, 1, 31, 23, 59, 0) # no exception
1310 self.theclass(2000, 1, 31, 23, 59, 59) # no exception
1311 self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 59, -1)
1312 self.assertRaises(ValueError, self.theclass, 2000, 1, 31, 23, 59, 60)
1314 self.theclass(2000, 1, 31, 23, 59, 59, 0) # no exception
1315 self.theclass(2000, 1, 31, 23, 59, 59, 999999) # no exception
1316 self.assertRaises(ValueError, self.theclass,
1318 self.assertRaises(ValueError, self.theclass,
1323 d = self.theclass(2000, 12, 31, 23, 30, 17)
1324 e = self.theclass(2000, 12, 31, 23, 30, 17)
1334 d = self.theclass(2001, 1, 1, 0, 5, 17)
1335 e = self.theclass(2001, 1, 1, 0, 5, 17)
1346 a = self.theclass(2002, 1, 31)
1347 b = self.theclass(1956, 1, 31)
1352 a = self.theclass(2002, 3, 2, 17, 6)
1357 self.assertEqual(a + hour, self.theclass(2002, 3, 2, 18, 6))
1358 self.assertEqual(hour + a, self.theclass(2002, 3, 2, 18, 6))
1359 self.assertEqual(a + 10*hour, self.theclass(2002, 3, 3, 3, 6))
1360 self.assertEqual(a - hour, self.theclass(2002, 3, 2, 16, 6))
1361 self.assertEqual(-hour + a, self.theclass(2002, 3, 2, 16, 6))
1363 self.assertEqual(a - 20*hour, self.theclass(2002, 3, 1, 21, 6))
1364 self.assertEqual(a + day, self.theclass(2002, 3, 3, 17, 6))
1365 self.assertEqual(a - day, self.theclass(2002, 3, 1, 17, 6))
1366 self.assertEqual(a + week, self.theclass(2002, 3, 9, 17, 6))
1367 self.assertEqual(a - week, self.theclass(2002, 2, 23, 17, 6))
1368 self.assertEqual(a + 52*week, self.theclass(2003, 3, 1, 17, 6))
1369 self.assertEqual(a - 52*week, self.theclass(2001, 3, 3, 17, 6))
1387 self.theclass(2002, 3, 10, 18, 6, 0, 1000))
1391 self.theclass(2002, 2, 22, 16, 5, 59, 999000))
1415 orig = self.theclass(*args)
1422 a = self.theclass(2003, 2, 7, 16, 48, 37, 444116)
1442 t1 = self.theclass(*args)
1443 t2 = self.theclass(*args)
1456 t2 = self.theclass(*newargs) # this is larger than t1
1487 got = self.theclass.fromtimestamp(ts)
1495 got = self.theclass.utcfromtimestamp(ts)
1501 self.assertEqual(self.theclass.fromtimestamp(0.9999999),
1502 self.theclass.fromtimestamp(1))
1510 self.assertRaises(ValueError, self.theclass.fromtimestamp,
1519 self.assertRaises(ValueError, self.theclass.utcfromtimestamp,
1525 self.theclass.fromtimestamp(-1.05)
1529 d = self.theclass.utcfromtimestamp(-1.05)
1530 self.assertEqual(d, self.theclass(1969, 12, 31, 23, 59, 58, 950000))
1539 from_now = self.theclass.utcnow()
1540 from_timestamp = self.theclass.utcfromtimestamp(time.time())
1552 expected = self.theclass(*(result[0:6]+(frac,)))
1553 got = self.theclass.strptime(string, format)
1558 t = self.theclass(2004, 12, 31, 6, 22, 33)
1580 t = self.theclass(2004, 12, 31, 6, 22, 33, 47)
1585 dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234)
1592 expected = self.theclass(2002, 3, 4, 18, 45, 3, 1234)
1593 combine = self.theclass.combine
1611 cls = self.theclass
1638 dt = self.theclass.now()
1660 class C(self.theclass):
1666 result = self.theclass.__new__(cls, *args, **temp)
1675 dt1 = self.theclass(*args)
1690 theclass = time
1693 t = self.theclass(12, 0)
1702 t = self.theclass(12, 59, 59, 8000)
1709 t = self.theclass(1, 2, 3, 4)
1719 t2 = self.theclass(t.hour, t.minute, t.second,
1725 t1 = self.theclass(*args)
1726 t2 = self.theclass(*args)
1739 t2 = self.theclass(*newargs) # this is larger than t1
1772 self.theclass(0, 0) # no exception
1773 self.theclass(23, 0) # no exception
1774 self.assertRaises(ValueError, self.theclass, -1, 0)
1775 self.assertRaises(ValueError, self.theclass, 24, 0)
1777 self.theclass(23, 0) # no exception
1778 self.theclass(23, 59) # no exception
1779 self.assertRaises(ValueError, self.theclass, 23, -1)
1780 self.assertRaises(ValueError, self.theclass, 23, 60)
1782 self.theclass(23, 59, 0) # no exception
1783 self.theclass(23, 59, 59) # no exception
1784 self.assertRaises(ValueError, self.theclass, 23, 59, -1)
1785 self.assertRaises(ValueError, self.theclass, 23, 59, 60)
1787 self.theclass(23, 59, 59, 0) # no exception
1788 self.theclass(23, 59, 59, 999999) # no exception
1789 self.assertRaises(ValueError, self.theclass, 23, 59, 59, -1)
1790 self.assertRaises(ValueError, self.theclass, 23, 59, 59, 1000000)
1793 d = self.theclass(23, 30, 17)
1794 e = self.theclass(23, 30, 17)
1804 d = self.theclass(0, 5, 17)
1805 e = self.theclass(0, 5, 17)
1816 t = self.theclass(4, 5, 1, 123)
1820 t = self.theclass()
1824 t = self.theclass(microsecond=1)
1828 t = self.theclass(microsecond=10)
1832 t = self.theclass(microsecond=100)
1836 t = self.theclass(microsecond=1000)
1840 t = self.theclass(microsecond=10000)
1844 t = self.theclass(microsecond=100000)
1850 t = self.theclass(second=1)
1854 t = self.theclass(1, 2, 3, 4)
1860 t = self.theclass(1, 2, 3, 4)
1864 class A(self.theclass):
1871 class B(self.theclass):
1884 self.assertEqual(str(self.theclass(1, 2, 3, 4)), "01:02:03.000004")
1885 self.assertEqual(str(self.theclass(10, 2, 3, 4000)), "10:02:03.004000")
1886 self.assertEqual(str(self.theclass(0, 2, 3, 400000)), "00:02:03.400000")
1887 self.assertEqual(str(self.theclass(12, 2, 3, 0)), "12:02:03")
1888 self.assertEqual(str(self.theclass(23, 15, 0, 0)), "23:15:00")
1891 name = 'datetime.' + self.theclass.__name__
1892 self.assertEqual(repr(self.theclass(1, 2, 3, 4)),
1894 self.assertEqual(repr(self.theclass(10, 2, 3, 4000)),
1896 self.assertEqual(repr(self.theclass(0, 2, 3, 400000)),
1898 self.assertEqual(repr(self.theclass(12, 2, 3, 0)),
1900 self.assertEqual(repr(self.theclass(23, 15, 0, 0)),
1904 self.assertIsInstance(self.theclass.min, self.theclass)
1905 self.assertIsInstance(self.theclass.max, self.theclass)
1906 self.assertIsInstance(self.theclass.resolution, timedelta)
1907 self.assertTrue(self.theclass.max > self.theclass.min)
1911 orig = self.theclass(*args)
1926 cls = self.theclass
1935 cls = self.theclass
1961 class C(self.theclass):
1967 result = self.theclass.__new__(cls, *args, **temp)
1976 dt1 = self.theclass(*args)
1989 self.assertRaises(TypeError, self.theclass,
1993 # theclass as a class atribute, and theclass(1, 1, 1, tzinfo=whatever)
1998 cls = self.theclass
2016 cls = self.theclass
2038 cls = self.theclass
2060 cls = self.theclass
2108 cls = self.theclass
2156 theclass = time
2159 t = self.theclass()
2249 t1 = self.theclass(0, 1, 2, 3, tzinfo=FixedOffset(1439, ""))
2250 t2 = self.theclass(0, 0, 2, 3, tzinfo=FixedOffset(1438, ""))
2253 t1 = self.theclass(23, 58, 6, 100, tzinfo=FixedOffset(-1000, ""))
2254 t2 = self.theclass(23, 48, 6, 100, tzinfo=FixedOffset(-1010, ""))
2260 orig = self.theclass(*args)
2268 orig = self.theclass(5, 6, 7, tzinfo=tinfo)
2279 cls = self.theclass
2306 cls = self.theclass
2376 class C(self.theclass):
2382 result = self.theclass.__new__(cls, *args, **temp)
2391 dt1 = self.theclass(*args)
2404 theclass = datetime
2407 dt = self.theclass(1, 2, 3, 4, 5, 6, 7)
2422 t1 = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, ""))
2424 t2 = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999,
2436 t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""))
2437 t2 = self.theclass(2, 1, 1, 3, 13, tzinfo=FixedOffset(3*60+13+2, ""))
2441 t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(0, ""))
2445 t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(2, ""))
2449 t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""),
2454 t1 = self.theclass(1, 12, 31, 23, 59, tzinfo=FixedOffset(1, ""),
2459 t2 = self.theclass.min
2466 t2 = self.theclass(5, 6, 7, tzinfo=Naive())
2472 t1 = self.theclass(5, 6, 7)
2479 t1 = self.theclass(2, 2, 2, tzinfo=Bogus())
2480 t2 = self.theclass(2, 2, 2, tzinfo=FixedOffset(0, ""))
2486 orig = self.theclass(*args)
2494 orig = self.theclass(*args, **{'tzinfo': tinfo})
2495 derived = self.theclass(1, 1, 1, tzinfo=FixedOffset(0, "", 0))
2508 t = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, ""))
2510 t = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999,
2515 t = self.theclass(5, 5, 5, tzinfo=FixedOffset(-1440, ""))
2558 dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234, tzinfo=met)
2566 now = self.theclass.now()
2569 nowaware = self.theclass.combine(now.date(), timeaware)
2618 min = self.theclass(1, 1, 1, tzinfo=FixedOffset(1439, "min"))
2619 max = self.theclass(MAXYEAR, 12, 31, 23, 59, 59, 999999,
2622 self.assertEqual(maxdiff, self.theclass.max - self.theclass.min +
2626 meth = self.theclass.now
2663 meth = self.theclass.fromtimestamp
2697 meth = self.theclass.utcnow
2708 meth = self.theclass.utcfromtimestamp
2729 cls = self.theclass
2763 cls = self.theclass
2824 cls = self.theclass
2839 cls = self.theclass
2883 dt = self.theclass.now(tz=f44m)
2909 cls = self.theclass
2984 class C(self.theclass):
2990 result = self.theclass.__new__(cls, *args, **temp)
2999 dt1 = self.theclass(*args)
3083 theclass = datetime
3251 now = self.theclass.now().replace(tzinfo=utc_real)