mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 12:01:28 +00:00
[test/utils] Add test for date_from_str
This commit is contained in:
parent
6c4c7539f2
commit
eb9c3edd5e
|
@ -20,6 +20,7 @@
|
||||||
args_to_str,
|
args_to_str,
|
||||||
encode_base_n,
|
encode_base_n,
|
||||||
clean_html,
|
clean_html,
|
||||||
|
date_from_str,
|
||||||
DateRange,
|
DateRange,
|
||||||
detect_exe_version,
|
detect_exe_version,
|
||||||
determine_ext,
|
determine_ext,
|
||||||
|
@ -234,6 +235,13 @@ def test_unescape_html(self):
|
||||||
self.assertEqual(unescapeHTML('é'), 'é')
|
self.assertEqual(unescapeHTML('é'), 'é')
|
||||||
self.assertEqual(unescapeHTML('�'), '�')
|
self.assertEqual(unescapeHTML('�'), '�')
|
||||||
|
|
||||||
|
def test_date_from_str(self):
|
||||||
|
self.assertEqual(date_from_str('yesterday'), date_from_str('now-1day'))
|
||||||
|
self.assertEqual(date_from_str('now+7day'), date_from_str('now+1week'))
|
||||||
|
self.assertEqual(date_from_str('now+14day'), date_from_str('now+2week'))
|
||||||
|
self.assertEqual(date_from_str('now+365day'), date_from_str('now+1year'))
|
||||||
|
self.assertEqual(date_from_str('now+30day'), date_from_str('now+1month'))
|
||||||
|
|
||||||
def test_daterange(self):
|
def test_daterange(self):
|
||||||
_20century = DateRange("19000101", "20000101")
|
_20century = DateRange("19000101", "20000101")
|
||||||
self.assertFalse("17890714" in _20century)
|
self.assertFalse("17890714" in _20century)
|
||||||
|
|
Loading…
Reference in a new issue