Skip to content

Commit 9d415fa

Browse files
committed
Adding tests for indexing strings via bulk helpers
1 parent 1378073 commit 9d415fa

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

elasticsearch/helpers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def expand_action(data):
2727
"""
2828
# when given a string, assume user wants to index raw json
2929
if isinstance(data, string_types):
30-
return '{"index": {}}', data
30+
return '{"index":{}}', data
3131

3232
# make sure we don't alter the action
3333
data = data.copy()

test_elasticsearch/test_helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ def test_chunks_are_chopped_by_byte_size(self):
3636

3737
def test_chunks_are_chopped_by_chunk_size(self):
3838
self.assertEquals(10, len(list(helpers._chunk_actions(self.actions, 10, 99999999, JSONSerializer()))))
39+
40+
class TestExpandActions(TestCase):
41+
def test_string_actions_are_marked_as_simple_inserts(self):
42+
self.assertEquals(('{"index":{}}', "whatever"), helpers.expand_action('whatever'))

0 commit comments

Comments
 (0)