����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 3.17.187.188 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /snap/lxd/32662/lib/python3/dist-packages/ceph/tests/ |
Upload File : |
import datetime import pytest from ceph.utils import datetime_now, datetime_to_str, str_to_datetime def test_datetime_to_str_1(): dt = datetime.datetime.now() assert type(datetime_to_str(dt)) is str def test_datetime_to_str_2(): # note: tz isn't specified in the string, so explicitly store this as UTC dt = datetime.datetime.strptime( '2019-04-24T17:06:53.039991', '%Y-%m-%dT%H:%M:%S.%f' ).replace(tzinfo=datetime.timezone.utc) assert datetime_to_str(dt) == '2019-04-24T17:06:53.039991Z' def test_datetime_to_str_3(): dt = datetime.datetime.strptime('2020-11-02T04:40:12.748172-0800', '%Y-%m-%dT%H:%M:%S.%f%z') assert datetime_to_str(dt) == '2020-11-02T12:40:12.748172Z' def test_str_to_datetime_1(): dt = str_to_datetime('2020-03-03T09:21:43.636153304Z') assert type(dt) is datetime.datetime assert dt.tzinfo is not None def test_str_to_datetime_2(): dt = str_to_datetime('2020-03-03T15:52:30.136257504-0600') assert type(dt) is datetime.datetime assert dt.tzinfo is not None def test_str_to_datetime_3(): dt = str_to_datetime('2020-03-03T15:52:30.136257504') assert type(dt) is datetime.datetime assert dt.tzinfo is not None def test_str_to_datetime_invalid_format_1(): with pytest.raises(ValueError): str_to_datetime('2020-03-03 15:52:30.136257504') def test_str_to_datetime_invalid_format_2(): with pytest.raises(ValueError): str_to_datetime('2020-03-03') def test_datetime_now_1(): dt = str_to_datetime('2020-03-03T09:21:43.636153304Z') dt_now = datetime_now() assert type(dt_now) is datetime.datetime assert dt_now.tzinfo is not None assert dt < dt_now