Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
chore(line_protocol): fix repr and handle boolean values
Browse files Browse the repository at this point in the history
  • Loading branch information
sebito91 committed Apr 9, 2020
1 parent 76e0125 commit bc922a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions influxdb/line_protocol.py
Expand Up @@ -112,6 +112,9 @@ def _escape_value(value):
if isinstance(value, integer_types) and not isinstance(value, bool):
return str(value) + 'i'

if isinstance(value, bool):
return str(value)

if _is_float(value):
return repr(float(value))

Expand Down
4 changes: 2 additions & 2 deletions influxdb/tests/test_line_protocol.py
Expand Up @@ -176,12 +176,12 @@ def test_float_with_long_decimal_fraction_as_type_decimal(self):
{
"measurement": "test",
"fields": {
"float_val": Decimal(1.0000000000000009),
"float_val": Decimal(0.8289445733333332),
}
}
]
}
self.assertEqual(
line_protocol.make_lines(data),
'test float_val=1.0000000000000009\n'
'test float_val=0.8289445733333332\n'
)

0 comments on commit bc922a9

Please sign in to comment.