Skip to content

Commit 4b645af

Browse files
author
Val Brodsky
committed
Add test
1 parent 15cd578 commit 4b645af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/unit/test_utils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
from labelbox.utils import format_iso_datetime, format_iso_from_string
3+
4+
5+
@pytest.mark.parametrize(
6+
'datetime_str, expected_datetime_str',
7+
[
8+
('2011-11-04T00:05:23Z', '2011-11-04T00:05:23Z'),
9+
('2011-11-04T00:05:23+00:00', '2011-11-04T00:05:23Z'),
10+
('2011-11-04T00:05:23+05:00', '2011-11-04T00:05:23Z'
11+
), #NOTE not converting with timezone... this is compatible with out current implementation
12+
('2011-11-04T00:05:23', '2011-11-04T00:05:23Z')
13+
])
14+
def test_datetime_parsing(datetime_str, expected_datetime_str):
15+
# NOTE I would normally not tested expected using another function from sdk code, but in this case this is exactly the usage in _validate_parse_datetime
16+
assert format_iso_datetime(
17+
format_iso_from_string(datetime_str)) == expected_datetime_str

0 commit comments

Comments
 (0)