Skip to content

Commit 64d03be

Browse files
committed
tests: add unicode test for line_protocol.make_line.
I'm discovered problems, while try to write data, with tags in unicode.
1 parent c101386 commit 64d03be

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

influxdb/tests/test_line_protocol.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
23

34
import sys
45
if sys.version_info < (2, 7):
@@ -55,3 +56,23 @@ def test_string_val_newline(self):
5556
line_protocol.make_lines(data),
5657
'm1 multi_line="line1\\nline1\\nline3"\n'
5758
)
59+
60+
def test_make_lines_unicode(self):
61+
data = {
62+
"tags": {
63+
"unicode_tag": "\'Привет!\'" # Hello! in Russian
64+
},
65+
"points": [
66+
{
67+
"measurement": "test",
68+
"fields": {
69+
"unicode_val": "Привет!", # Hello! in Russian
70+
}
71+
}
72+
]
73+
}
74+
75+
self.assertEqual(
76+
line_protocol.make_lines(data),
77+
'test,unicode_tag=\'Привет!\' unicode_val="Привет!"\n'
78+
)

0 commit comments

Comments
 (0)