File tree 2 files changed +11
-1
lines changed
influxdb_client/client/write
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ def _append_fields(fields):
165
165
elif isinstance (value , str ):
166
166
_return .append (f'{ _escape_key (field )} ="{ _escape_string (value )} "' )
167
167
else :
168
- raise ValueError ()
168
+ raise ValueError (f'Type: " { type ( value ) } " of field: " { field } " is not supported.' )
169
169
170
170
return f"{ ',' .join (_return )} "
171
171
Original file line number Diff line number Diff line change @@ -369,6 +369,16 @@ def test_points_from_different_timezones(self):
369
369
point_hk = Point .measurement ("h2o" ).field ("val" , 1 ).time (time_in_hk )
370
370
self .assertEqual (point_utc .to_line_protocol (), point_hk .to_line_protocol ())
371
371
372
+ def test_unsupported_field_type (self ):
373
+ with self .assertRaises (ValueError ) as ve :
374
+ Point .measurement ("h2o" ) \
375
+ .tag ("location" , "europe" ) \
376
+ .field ("level" , UTC ) \
377
+ .to_line_protocol ()
378
+ exception = ve .exception
379
+
380
+ self .assertEqual ('Type: "<class \' pytz.UTC\' >" of field: "level" is not supported.' , f'{ exception } ' )
381
+
372
382
373
383
if __name__ == '__main__' :
374
384
unittest .main ()
You can’t perform that action at this time.
0 commit comments