add alternatives for deprecated utc datetime functions
This commit is contained in:
@@ -14,7 +14,7 @@ import unittest
|
||||
import datetime
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from gallery_dl import text # noqa E402
|
||||
from gallery_dl import text, util # noqa E402
|
||||
|
||||
|
||||
INVALID = ((), [], {}, None, 1, 2.3)
|
||||
@@ -414,8 +414,8 @@ class TestText(unittest.TestCase):
|
||||
self.assertEqual(f(value), {})
|
||||
|
||||
def test_parse_timestamp(self, f=text.parse_timestamp):
|
||||
null = datetime.datetime.utcfromtimestamp(0)
|
||||
value = datetime.datetime.utcfromtimestamp(1555816235)
|
||||
null = util.datetime_utcfromtimestamp(0)
|
||||
value = util.datetime_utcfromtimestamp(1555816235)
|
||||
|
||||
self.assertEqual(f(0) , null)
|
||||
self.assertEqual(f("0") , null)
|
||||
@@ -427,7 +427,7 @@ class TestText(unittest.TestCase):
|
||||
self.assertEqual(f(value, "foo"), "foo")
|
||||
|
||||
def test_parse_datetime(self, f=text.parse_datetime):
|
||||
null = datetime.datetime.utcfromtimestamp(0)
|
||||
null = util.datetime_utcfromtimestamp(0)
|
||||
|
||||
self.assertEqual(f("1970-01-01T00:00:00+00:00"), null)
|
||||
self.assertEqual(f("1970-01-01T00:00:00+0000") , null)
|
||||
|
||||
Reference in New Issue
Block a user