<s> from __future__ import unicode_literals <EOL> from pyeqs . dsl import Aggregations <EOL> from tests . helpers import homogeneous <EOL> def test_add_agg ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_with_size ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , size = <NUM_LIT:1> ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT:size>" : <NUM_LIT:1> <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_with_order ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , order_type = "<STR_LIT>" , order_dir = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT:size>" : <NUM_LIT:0> <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_with_min_doc_count ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , min_doc_count = <NUM_LIT:10> ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:10> , <EOL> "<STR_LIT:size>" : <NUM_LIT:0> <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_nested ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , nested_path = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT:path>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } } , <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_nested_with_size ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , size = <NUM_LIT:1> , <EOL> nested_path = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT:path>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT:size>" : <NUM_LIT:1> <EOL> } } <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_nested_with_order ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , order_type = "<STR_LIT>" , order_dir = "<STR_LIT>" , <EOL> nested_path = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT:path>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:1> , <EOL> "<STR_LIT:size>" : <NUM_LIT:0> <EOL> } } <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_nested_with_min_doc_count ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , min_doc_count = <NUM_LIT:10> , <EOL> nested_path = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT:path>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:10> , <EOL> "<STR_LIT:size>" : <NUM_LIT:0> <EOL> } } <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_filtered ( ) : <EOL> """<STR_LIT>""" <EOL> filter_value = { "<STR_LIT>" : { "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT:value>" } } } <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , filter_val = filter_value , <EOL> filter_name = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : filter_value , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } } <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_global ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , global_name = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } } <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_range ( ) : <EOL> """<STR_LIT>""" <EOL> range_list = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , range_list = range_list , range_name = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : [ <EOL> { "<STR_LIT:to>" : <NUM_LIT:1> } , <EOL> { "<STR_LIT>" : <NUM_LIT:1> , "<STR_LIT:to>" : <NUM_LIT:2> } , <EOL> { "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT:to>" : <NUM_LIT:3> } , <EOL> { "<STR_LIT>" : <NUM_LIT:3> } <EOL> ] <EOL> } } <EOL> } <EOL> homogeneous ( t , results ) <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , range_list = range_list ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : [ <EOL> { "<STR_LIT:to>" : <NUM_LIT:1> } , <EOL> { "<STR_LIT>" : <NUM_LIT:1> , "<STR_LIT:to>" : <NUM_LIT:2> } , <EOL> { "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT:to>" : <NUM_LIT:3> } , <EOL> { "<STR_LIT>" : <NUM_LIT:3> } <EOL> ] <EOL> } } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_histogram ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , histogram_interval = <NUM_LIT:20> ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:20> , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:1> <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_histogram_with_order ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , histogram_interval = <NUM_LIT:20> , <EOL> order_type = "<STR_LIT>" , order_dir = "<STR_LIT>" ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:20> , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:1> <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) <EOL> def test_add_agg_histogram_with_min_doc_count ( ) : <EOL> """<STR_LIT>""" <EOL> t = Aggregations ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , histogram_interval = <NUM_LIT:20> , <EOL> min_doc_count = <NUM_LIT:10> ) <EOL> results = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:20> , <EOL> "<STR_LIT>" : { "<STR_LIT>" : "<STR_LIT>" } , <EOL> "<STR_LIT>" : <NUM_LIT:10> <EOL> } <EOL> } <EOL> } <EOL> homogeneous ( t , results ) </s>
