@@ -81,7 +81,7 @@ def test_convert_value_raises(value, feature):
81
81
@pytest .mark .parametrize (
82
82
'value,feature,expected_value' ,
83
83
[
84
- # datetime
84
+ # Datetime.
85
85
(
86
86
datetime .datetime (1970 , 1 , 1 , tzinfo = datetime .timezone .utc ),
87
87
feature_lib .Scalar (dtype = np .int64 ),
@@ -92,14 +92,14 @@ def test_convert_value_raises(value, feature):
92
92
feature_lib .Scalar (dtype = np .int64 ),
93
93
86400 ,
94
94
),
95
- # scalar
95
+ # Scalar.
96
96
(42 , feature_lib .Scalar (dtype = np .int64 ), 42 ),
97
97
(42 , feature_lib .Scalar (dtype = np .int32 ), 42 ),
98
98
('abc' , feature_lib .Scalar (dtype = np .object_ ), 'abc' ),
99
99
(True , feature_lib .Scalar (dtype = np .bool_ ), True ),
100
100
(False , feature_lib .Scalar (dtype = np .bool_ ), False ),
101
101
(42.0 , feature_lib .Scalar (dtype = np .float32 ), 42.0 ),
102
- # sequence
102
+ # Sequence.
103
103
([42 ], feature_lib .Sequence (feature = tf .int64 ), [42 ]),
104
104
(42 , feature_lib .Sequence (feature = tf .int64 ), [42 ]),
105
105
(None , feature_lib .Sequence (feature = tf .int64 ), []),
@@ -111,15 +111,15 @@ def test_convert_value_raises(value, feature):
111
111
),
112
112
{'someint' : [b'' , 'string' , b'' ]},
113
113
),
114
- # image
114
+ # Image.
115
115
(
116
116
lazy_imports_lib .lazy_imports .PIL_Image .new (mode = 'L' , size = (4 , 4 )),
117
117
feature_lib .Image (),
118
118
lazy_imports_lib .lazy_imports .PIL_Image .new (
119
119
mode = 'RGB' , size = (4 , 4 )
120
120
),
121
121
),
122
- # dict
122
+ # Dict.
123
123
(
124
124
{
125
125
'de' : b'Hallo Welt' ,
@@ -148,7 +148,18 @@ def test_convert_value_raises(value, feature):
148
148
}),
149
149
{'name' : b'Name' , 'age' : 100 },
150
150
),
151
- # nan, but the feature type is not float
151
+ # Video.
152
+ (
153
+ {'path' : 'path/to/video.avi' , 'bytes' : None },
154
+ feature_lib .Video (),
155
+ 'path/to/video.avi' ,
156
+ ),
157
+ (
158
+ {'path' : None , 'bytes' : b'video_bytes' },
159
+ feature_lib .Video (),
160
+ b'video_bytes' ,
161
+ ),
162
+ # nan, but the feature type is not float.
152
163
(
153
164
np .nan ,
154
165
feature_lib .Text (),
0 commit comments