<s> import functools <EOL> import json <EOL> import logging <EOL> import os <EOL> import time <EOL> from copy import deepcopy <EOL> from datadiff . tools import assert_equal as assertDictEquals <EOL> from elasticsearch import Elasticsearch , ElasticsearchException , TransportError <EOL> from mock import Mock <EOL> from random import randint <EOL> from superelasticsearch import SuperElasticsearch <EOL> from superelasticsearch import BulkOperation <EOL> from superelasticsearch import _BulkAction <EOL> try : <EOL> import unittest2 as unittest <EOL> except ImportError : <EOL> import unittest <EOL> elasticsearch_logger = logging . getLogger ( '<STR_LIT>' ) <EOL> elasticsearch_logger . setLevel ( logging . ERROR ) <EOL> local_path = lambda x : os . path . join ( os . path . dirname ( __file__ ) , x ) <EOL> class TestItersearch ( unittest . TestCase ) : <EOL> es = Elasticsearch ( hosts = [ '<STR_LIT>' ] ) <EOL> ss = SuperElasticsearch ( hosts = [ '<STR_LIT>' ] ) <EOL> _index = '<STR_LIT>' % randint ( <NUM_LIT:0> , <NUM_LIT:1000> ) <EOL> _doc_type = '<STR_LIT>' % randint ( <NUM_LIT:0> , <NUM_LIT:1000> ) <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> cls . _total_docs = <NUM_LIT:0> <EOL> with open ( local_path ( '<STR_LIT>' ) , '<STR_LIT:r>' ) as f : <EOL> data = json . loads ( f . read ( ) ) <EOL> for doc in data : <EOL> cls . es . index ( index = cls . _index , <EOL> doc_type = cls . _doc_type , <EOL> body = doc ) <EOL> cls . _total_docs += <NUM_LIT:1> <EOL> def test_itersearch_raises_typeerror_when_scroll_param_is_missing ( self ) : <EOL> self . assertRaises ( TypeError , self . ss . itersearch ) <EOL> def test_chunked_itersearch_performs_scroll ( self ) : <EOL> for size in ( <NUM_LIT:10> , <NUM_LIT:100> ) : <EOL> scrollCounter = <NUM_LIT:0> <EOL> docsCounter = <NUM_LIT:0> <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> for docs in self . ss . itersearch ( index = self . _index , <EOL> doc_type = self . _doc_type , <EOL> body = dict ( <EOL> query = dict ( match_all = { } ) ) , <EOL> scroll = '<STR_LIT>' , size = size ) : <EOL> scrollCounter += <NUM_LIT:1> <EOL> docsCounter += len ( docs ) <EOL> self . assertEquals ( scrollCounter , self . _total_docs / size + <NUM_LIT:1> ) <EOL> def test_non_chunked_itersearch_performs_scroll ( self ) : <EOL> for size in ( <NUM_LIT:10> , <NUM_LIT:100> ) : <EOL> docsCounter = <NUM_LIT:0> <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> for doc in self . ss . itersearch ( index = self . _index , <EOL> doc_type = self . _doc_type , <EOL> body = dict ( query = dict ( match_all = { } ) ) , <EOL> scroll = '<STR_LIT>' , size = size , <EOL> chunked = False ) : <EOL> docsCounter += <NUM_LIT:1> <EOL> self . assertEquals ( docsCounter , self . _total_docs ) <EOL> def test_chunked_itersearch_with_meta_returns_meta ( self ) : <EOL> for size in ( <NUM_LIT:10> , <NUM_LIT:100> ) : <EOL> scrollCounter = <NUM_LIT:0> <EOL> docsCounter = <NUM_LIT:0> <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> for docs , meta in self . ss . itersearch ( index = self . _index , <EOL> doc_type = self . _doc_type , <EOL> body = dict ( query = dict ( <EOL> match_all = { } ) ) , <EOL> scroll = '<STR_LIT>' , size = size , <EOL> chunked = True , <EOL> with_meta = True ) : <EOL> docsCounter += len ( docs ) <EOL> scrollCounter += <NUM_LIT:1> <EOL> self . assertEquals ( docsCounter , self . _total_docs ) <EOL> self . assertEquals ( scrollCounter , self . _total_docs / size + <NUM_LIT:1> ) <EOL> self . assertTrue ( isinstance ( meta , dict ) ) <EOL> self . assertEquals ( meta [ '<STR_LIT>' ] [ '<STR_LIT>' ] , self . _total_docs ) <EOL> def test_non_chunked_itersearch_with_meta_returns_meta ( self ) : <EOL> for size in ( <NUM_LIT:10> , <NUM_LIT:100> ) : <EOL> docsCounter = <NUM_LIT:0> <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> for doc , meta in self . ss . itersearch ( index = self . _index , <EOL> doc_type = self . _doc_type , <EOL> body = dict ( query = dict ( <EOL> match_all = { } ) ) , <EOL> scroll = '<STR_LIT>' , size = size , <EOL> chunked = False , <EOL> with_meta = True ) : <EOL> docsCounter += <NUM_LIT:1> <EOL> self . assertEquals ( docsCounter , self . _total_docs ) <EOL> self . assertTrue ( isinstance ( meta , dict ) ) <EOL> self . assertEquals ( meta [ '<STR_LIT>' ] [ '<STR_LIT>' ] , self . _total_docs ) <EOL> def test_itersearch_raises_assertion_error_when_less_docs_fetched ( self ) : <EOL> mocked_value_template = { <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : <NUM_LIT:2> , <EOL> "<STR_LIT>" : <NUM_LIT:2> , <EOL> "<STR_LIT>" : <NUM_LIT:0> <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : <NUM_LIT> , <EOL> "<STR_LIT>" : None , <EOL> "<STR_LIT>" : [ <EOL> dict ( some_doc = "<STR_LIT>" ) for i in xrange ( <NUM_LIT:10> ) <EOL> ] <EOL> } <EOL> } <EOL> ss = SuperElasticsearch ( hosts = [ '<STR_LIT>' ] ) <EOL> def assertion ( chunked ) : <EOL> mocked_search_result = deepcopy ( mocked_value_template ) <EOL> ss . search = Mock ( return_value = mocked_search_result ) <EOL> mocked_scroll_result = deepcopy ( mocked_value_template ) <EOL> mocked_scroll_result [ '<STR_LIT>' ] = <NUM_LIT> <EOL> mocked_scroll_result [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ <EOL> dict ( some_doc = "<STR_LIT>" ) for i in xrange ( <NUM_LIT:2> ) <EOL> ] <EOL> ss . scroll = Mock ( return_value = mocked_scroll_result ) <EOL> search_generator = ss . itersearch ( index = self . _index , <EOL> doc_type = self . _doc_type , <EOL> body = dict ( query = dict ( <EOL> match_all = { } ) ) , <EOL> scroll = '<STR_LIT>' , <EOL> chunked = chunked ) <EOL> if chunked : <EOL> iterate_times = <NUM_LIT:2> <EOL> else : <EOL> iterate_times = <NUM_LIT:12> <EOL> for _ in range ( <NUM_LIT:0> , iterate_times ) : <EOL> search_generator . next ( ) <EOL> mocked_scroll_result = deepcopy ( mocked_value_template ) <EOL> mocked_scroll_result [ '<STR_LIT>' ] = <NUM_LIT> <EOL> mocked_scroll_result [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ ] <EOL> ss . scroll = Mock ( return_value = mocked_scroll_result ) <EOL> search_generator . next ( ) <EOL> self . assertRaises ( ElasticsearchException , <EOL> functools . partial ( assertion , True ) ) <EOL> self . assertRaises ( ElasticsearchException , <EOL> functools . partial ( assertion , False ) ) <EOL> def test_that_itersearch_clears_scroll_on_successful_scroll ( self ) : <EOL> for docs , meta in self . ss . itersearch ( index = self . _index , <EOL> doc_type = self . _doc_type , <EOL> body = dict ( <EOL> query = dict ( match_all = { } ) ) , <EOL> scroll = '<STR_LIT>' , size = <NUM_LIT:100> , <EOL> with_meta = True ) : <EOL> scroll_id = meta [ '<STR_LIT>' ] <EOL> self . assertRaises ( TransportError , self . es . scroll , scroll_id ) <EOL> try : <EOL> self . es . scroll ( scroll_id ) <EOL> except TransportError , err : <EOL> self . assertTrue ( '<STR_LIT>' in str ( err ) ) <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> cls . es . indices . delete ( index = cls . _index ) <EOL> class TestBulkAction ( unittest . TestCase ) : <EOL> def test_bulk_action_must_not_accept_invalid_action ( self ) : <EOL> self . assertRaises ( Exception , _BulkAction , type = '<STR_LIT>' , params = { } ) <EOL> def test_bulk_action_must_accept_valid_actions ( self ) : <EOL> _BulkAction ( '<STR_LIT:index>' , params = { } , body = dict ( key1 = '<STR_LIT>' ) ) <EOL> _BulkAction ( '<STR_LIT>' , params = { } , body = dict ( key1 = '<STR_LIT>' ) ) <EOL> _BulkAction ( '<STR_LIT>' , params = { } , body = dict ( key1 = '<STR_LIT>' ) ) <EOL> _BulkAction ( '<STR_LIT>' , params = { } ) <EOL> def test_bulk_action_must_throw_exception_when_missing_expected_body ( self ) : <EOL> self . assertRaises ( Exception , _BulkAction , '<STR_LIT:index>' , params = { } ) <EOL> _BulkAction ( '<STR_LIT:index>' , params = { } , body = dict ( key1 = '<STR_LIT>' ) ) <EOL> def test_bulk_action_must_generate_valid_bulk_op_for_es ( self ) : <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> action = _BulkAction ( '<STR_LIT:index>' , params = { } , body = body ) <EOL> self . assertEquals ( action . es_op , <EOL> ( json . dumps ( { '<STR_LIT:index>' : { } } ) + '<STR_LIT:\n>' + <EOL> json . dumps ( body ) ) ) <EOL> action = _BulkAction ( '<STR_LIT>' , params = dict ( routing = '<STR_LIT>' , refresh = True ) , <EOL> body = body ) <EOL> self . assertEquals ( action . es_op , <EOL> ( json . dumps ( { '<STR_LIT>' : dict ( routing = '<STR_LIT>' , <EOL> refresh = True ) } ) + <EOL> '<STR_LIT:\n>' + json . dumps ( body ) ) ) <EOL> action = _BulkAction ( '<STR_LIT>' , params = dict ( routing = '<STR_LIT>' , refresh = True ) , <EOL> body = body ) <EOL> self . assertEquals ( action . es_op , <EOL> ( json . dumps ( { '<STR_LIT>' : dict ( routing = '<STR_LIT>' , <EOL> refresh = True ) } ) ) ) <EOL> class TestBulkOperation ( unittest . TestCase ) : <EOL> es = Elasticsearch ( hosts = [ '<STR_LIT>' ] ) <EOL> ss = SuperElasticsearch ( hosts = [ '<STR_LIT>' ] ) <EOL> _index = '<STR_LIT>' % randint ( <NUM_LIT:0> , <NUM_LIT:1000> ) <EOL> def setUp ( self ) : <EOL> self . _bulk = self . ss . bulk <EOL> def tearDown ( self ) : <EOL> self . ss . bulk = self . _bulk <EOL> def test_bulk_operation_returns_bulk_operation_object ( self ) : <EOL> self . assertTrue ( <EOL> isinstance ( self . ss . bulk_operation ( ) , BulkOperation ) ) <EOL> def test_bulk_operation_must_pass_superlelasticsearch_object ( self ) : <EOL> self . assertEquals ( self . ss , self . ss . bulk_operation ( ) . _client ) <EOL> def test_index_or_create_must_push_correct_action ( self ) : <EOL> bulk = self . ss . bulk_operation ( ) <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk . _index_or_create ( '<STR_LIT:index>' , body ) <EOL> action = bulk . _actions [ - <NUM_LIT:1> ] <EOL> self . assertEquals ( action . type , '<STR_LIT:index>' ) <EOL> assertDictEquals ( action . body , body ) <EOL> assertDictEquals ( action . params , { } ) <EOL> bulk . _index_or_create ( '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body , <EOL> id = <NUM_LIT:1> , consistency = '<STR_LIT>' , ttl = <NUM_LIT:200> ) <EOL> action = bulk . _actions [ - <NUM_LIT:1> ] <EOL> self . assertEquals ( action . type , '<STR_LIT>' ) <EOL> assertDictEquals ( action . body , body ) <EOL> assertDictEquals ( action . params , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> bulk . _index_or_create ( '<STR_LIT>' , index = '<STR_LIT>' , <EOL> doc_type = '<STR_LIT>' , body = body , <EOL> routing = '<STR_LIT>' , refresh = True ) <EOL> action = bulk . _actions [ - <NUM_LIT:1> ] <EOL> self . assertEquals ( action . type , '<STR_LIT>' ) <EOL> assertDictEquals ( action . body , body ) <EOL> assertDictEquals ( action . params , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:true>' , <EOL> } ) <EOL> def test_index_calls_index_or_create_method_with_correct_args ( self ) : <EOL> bulk = self . ss . bulk_operation ( ) <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk . _index_or_create = Mock ( ) <EOL> bulk . index ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body , <EOL> timeout = <NUM_LIT:200> ) <EOL> self . assertTrue ( bulk . _index_or_create ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , '<STR_LIT:index>' ) <EOL> assertDictEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] , body ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:0> ] [ <NUM_LIT:2> ] , None ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <NUM_LIT:200> ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:1> ] [ '<STR_LIT:index>' ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' ) <EOL> def test_create_calls_index_or_create_method_with_correct_args ( self ) : <EOL> bulk = self . ss . bulk_operation ( ) <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk . _index_or_create = Mock ( ) <EOL> bulk . create ( doc_type = '<STR_LIT>' , body = body , <EOL> id = <NUM_LIT:4> , timeout = <NUM_LIT:200> , routing = '<STR_LIT>' ) <EOL> self . assertTrue ( bulk . _index_or_create ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , '<STR_LIT>' ) <EOL> assertDictEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] , body ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:0> ] [ <NUM_LIT:2> ] , <NUM_LIT:4> ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <NUM_LIT:200> ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEquals ( bulk . _index_or_create . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' ) <EOL> def test_execute_must_empty_actions_after_executing_bulk_operation ( self ) : <EOL> bulk = self . ss . bulk_operation ( ) <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk . create ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body , <EOL> id = <NUM_LIT:4> , routing = '<STR_LIT>' ) <EOL> bulk . index ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body ) <EOL> bulk . execute ( ) <EOL> self . assertEquals ( len ( bulk . _actions ) , <NUM_LIT:0> ) <EOL> def test_execute_must_return_bulk_response ( self ) : <EOL> bulk = self . ss . bulk_operation ( ) <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk . create ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body , <EOL> id = <NUM_LIT:4> , routing = '<STR_LIT>' ) <EOL> bulk . index ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body ) <EOL> resp = bulk . execute ( ) <EOL> self . assertTrue ( isinstance ( resp , dict ) ) <EOL> self . assertTrue ( isinstance ( resp [ '<STR_LIT>' ] , list ) ) <EOL> self . assertEquals ( len ( resp [ '<STR_LIT>' ] ) , <NUM_LIT:2> ) <EOL> def test_execute_must_call_bulk_with_correct_body_arg ( self ) : <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk = self . ss . bulk_operation ( ) <EOL> bulk . _client . bulk = Mock ( ) <EOL> bulk . create ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body , <EOL> id = <NUM_LIT:4> , routing = '<STR_LIT>' ) <EOL> bulk . index ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body ) <EOL> expected_bulk_body = '<STR_LIT>' <EOL> for action in bulk . _actions : <EOL> expected_bulk_body += action . es_op + '<STR_LIT:\n>' <EOL> resp = bulk . execute ( ) <EOL> self . assertTrue ( bulk . _client . bulk . called ) <EOL> self . assertTrue ( isinstance ( bulk . _client . bulk . call_args [ <NUM_LIT:1> ] [ '<STR_LIT:body>' ] , str ) ) <EOL> self . assertEquals ( bulk . _client . bulk . call_args [ <NUM_LIT:1> ] [ '<STR_LIT:body>' ] , <EOL> expected_bulk_body ) <EOL> def test_execute_must_use_kwargs_provided_at_the_creation_of_bulk_op ( self ) : <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk = self . ss . bulk_operation ( index = '<STR_LIT>' , <EOL> doc_type = '<STR_LIT>' , <EOL> refresh = True ) <EOL> bulk . _client . bulk = Mock ( ) <EOL> bulk . create ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body , <EOL> id = <NUM_LIT:4> , routing = '<STR_LIT>' ) <EOL> bulk . index ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body ) <EOL> resp = bulk . execute ( ) <EOL> self . assertTrue ( bulk . _client . bulk . called ) <EOL> self . assertEquals ( bulk . _client . bulk . call_args [ <NUM_LIT:1> ] [ '<STR_LIT:index>' ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEquals ( bulk . _client . bulk . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEquals ( bulk . _client . bulk . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT:true>' ) <EOL> def test_execute_must_override_kwargs_provided_at_bulk_op_creation ( self ) : <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk = self . ss . bulk_operation ( index = '<STR_LIT>' , <EOL> doc_type = '<STR_LIT>' , <EOL> refresh = True ) <EOL> bulk . _client . bulk = Mock ( ) <EOL> bulk . create ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body , <EOL> id = <NUM_LIT:4> , routing = '<STR_LIT>' ) <EOL> bulk . index ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body ) <EOL> resp = bulk . execute ( index = '<STR_LIT>' , refresh = False ) <EOL> self . assertTrue ( bulk . _client . bulk . called ) <EOL> self . assertEquals ( bulk . _client . bulk . call_args [ <NUM_LIT:1> ] [ '<STR_LIT:index>' ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEquals ( bulk . _client . bulk . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEquals ( bulk . _client . bulk . call_args [ <NUM_LIT:1> ] [ '<STR_LIT>' ] , <EOL> '<STR_LIT:false>' ) <EOL> def test_update_must_push_correct_action ( self ) : <EOL> bulk = self . ss . bulk_operation ( ) <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk . update ( id = <NUM_LIT> , body = body ) <EOL> action = bulk . _actions [ - <NUM_LIT:1> ] <EOL> self . assertEquals ( action . type , '<STR_LIT>' ) <EOL> assertDictEquals ( action . body , body ) <EOL> assertDictEquals ( action . params , dict ( _id = <NUM_LIT> ) ) <EOL> bulk . update ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , body = body , <EOL> id = <NUM_LIT> , consistency = '<STR_LIT>' , ttl = <NUM_LIT:200> ) <EOL> action = bulk . _actions [ - <NUM_LIT:1> ] <EOL> self . assertEquals ( action . type , '<STR_LIT>' ) <EOL> assertDictEquals ( action . body , body ) <EOL> assertDictEquals ( action . params , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> def test_delete_must_push_correct_action ( self ) : <EOL> bulk = self . ss . bulk_operation ( ) <EOL> body = dict ( key1 = '<STR_LIT>' ) <EOL> bulk . delete ( id = <NUM_LIT> ) <EOL> action = bulk . _actions [ - <NUM_LIT:1> ] <EOL> self . assertEquals ( action . type , '<STR_LIT>' ) <EOL> assertDictEquals ( action . body , None ) <EOL> assertDictEquals ( action . params , dict ( _id = <NUM_LIT> ) ) <EOL> bulk . delete ( index = '<STR_LIT>' , doc_type = '<STR_LIT>' , <EOL> id = <NUM_LIT> , consistency = '<STR_LIT>' , parent = <NUM_LIT:1> ) <EOL> action = bulk . _actions [ - <NUM_LIT:1> ] <EOL> self . assertEquals ( action . type , '<STR_LIT>' ) <EOL> assertDictEquals ( action . body , None ) <EOL> assertDictEquals ( action . params , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> } ) <EOL> bulk . delete ( id = <NUM_LIT> , body = body ) <EOL> action = bulk . _actions [ - <NUM_LIT:1> ] <EOL> self . assertEquals ( action . type , '<STR_LIT>' ) <EOL> assertDictEquals ( action . body , None ) <EOL> assertDictEquals ( action . params , dict ( _id = <NUM_LIT> ) ) </s>
