Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit bc922a9

Browse files
committed
chore(line_protocol): fix repr and handle boolean values
1 parent 76e0125 commit bc922a9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

influxdb/line_protocol.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ def _escape_value(value):
112112
if isinstance(value, integer_types) and not isinstance(value, bool):
113113
return str(value) + 'i'
114114

115+
if isinstance(value, bool):
116+
return str(value)
117+
115118
if _is_float(value):
116119
return repr(float(value))
117120

influxdb/tests/test_line_protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ def test_float_with_long_decimal_fraction_as_type_decimal(self):
176176
{
177177
"measurement": "test",
178178
"fields": {
179-
"float_val": Decimal(1.0000000000000009),
179+
"float_val": Decimal(0.8289445733333332),
180180
}
181181
}
182182
]
183183
}
184184
self.assertEqual(
185185
line_protocol.make_lines(data),
186-
'test float_val=1.0000000000000009\n'
186+
'test float_val=0.8289445733333332\n'
187187
)

0 commit comments

Comments
 (0)