Skip to content

Commit 529668c

Browse files
author
Val Brodsky
committed
Add test
1 parent 15cd578 commit 529668c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

labelbox/schema/data_row_metadata.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from itertools import chain
66
from typing import List, Optional, Dict, Union, Callable, Type, Any, Generator
77

8-
from dateutil.parser import isoparse
98
from pydantic import BaseModel, conlist, constr
109

1110
from labelbox.schema.ontology import SchemaId

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)