Unused since c72dde41e6
.
This commit is contained in:
parent
1061f52436
commit
44accb066a
|
@ -7,10 +7,8 @@
|
|||
# >>> datetime_safe.date(10, 8, 2).strftime("%Y/%m/%d was a %A")
|
||||
# '0010/08/02 was a Monday'
|
||||
|
||||
import time as ttime
|
||||
from datetime import (
|
||||
date as real_date, datetime as real_datetime, time as real_time,
|
||||
)
|
||||
import time
|
||||
from datetime import date as real_date, datetime as real_datetime
|
||||
|
||||
from django.utils.regex_helper import _lazy_re_compile
|
||||
|
||||
|
@ -34,10 +32,6 @@ class datetime(real_datetime):
|
|||
return date(self.year, self.month, self.day)
|
||||
|
||||
|
||||
class time(real_time):
|
||||
pass
|
||||
|
||||
|
||||
def new_date(d):
|
||||
"Generate a safe date from a datetime.date object."
|
||||
return date(d.year, d.month, d.day)
|
||||
|
@ -88,10 +82,10 @@ def strftime(dt, fmt):
|
|||
# Move to around the year 2000
|
||||
year = year + ((2000 - year) // 28) * 28
|
||||
timetuple = dt.timetuple()
|
||||
s1 = ttime.strftime(fmt, (year,) + timetuple[1:])
|
||||
s1 = time.strftime(fmt, (year,) + timetuple[1:])
|
||||
sites1 = _findall(s1, str(year))
|
||||
|
||||
s2 = ttime.strftime(fmt, (year + 28,) + timetuple[1:])
|
||||
s2 = time.strftime(fmt, (year + 28,) + timetuple[1:])
|
||||
sites2 = _findall(s2, str(year + 28))
|
||||
|
||||
sites = []
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
from datetime import (
|
||||
date as original_date, datetime as original_datetime,
|
||||
time as original_time,
|
||||
)
|
||||
from datetime import date as original_date, datetime as original_datetime
|
||||
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.datetime_safe import date, datetime, time
|
||||
from django.utils.datetime_safe import date, datetime
|
||||
|
||||
|
||||
class DatetimeTests(SimpleTestCase):
|
||||
|
@ -13,7 +10,6 @@ class DatetimeTests(SimpleTestCase):
|
|||
self.percent_y_safe = (1900, 1, 1) # >= 1900 required on Windows.
|
||||
self.just_safe = (1000, 1, 1)
|
||||
self.just_unsafe = (999, 12, 31, 23, 59, 59)
|
||||
self.just_time = (11, 30, 59)
|
||||
self.really_old = (20, 1, 1)
|
||||
self.more_recent = (2006, 1, 1)
|
||||
|
||||
|
@ -30,10 +26,6 @@ class DatetimeTests(SimpleTestCase):
|
|||
original_datetime(*self.just_safe).strftime('%Y-%m-%d'), datetime(*self.just_safe).strftime('%Y-%m-%d')
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
original_time(*self.just_time).strftime('%H:%M:%S'), time(*self.just_time).strftime('%H:%M:%S')
|
||||
)
|
||||
|
||||
def test_safe_strftime(self):
|
||||
self.assertEqual(date(*self.just_unsafe[:3]).strftime('%Y-%m-%d (weekday %w)'), '0999-12-31 (weekday 2)')
|
||||
self.assertEqual(date(*self.just_safe).strftime('%Y-%m-%d (weekday %w)'), '1000-01-01 (weekday 3)')
|
||||
|
@ -45,8 +37,6 @@ class DatetimeTests(SimpleTestCase):
|
|||
datetime(*self.just_safe).strftime('%Y-%m-%d %H:%M:%S (weekday %w)'), '1000-01-01 00:00:00 (weekday 3)'
|
||||
)
|
||||
|
||||
self.assertEqual(time(*self.just_time).strftime('%H:%M:%S AM'), '11:30:59 AM')
|
||||
|
||||
# %y will error before this date
|
||||
self.assertEqual(date(*self.percent_y_safe).strftime('%y'), '00')
|
||||
self.assertEqual(datetime(*self.percent_y_safe).strftime('%y'), '00')
|
||||
|
|
Loading…
Reference in New Issue