Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_agg_date_histogram(self):
agg = Agg()
agg._result_dict = {
'took': 3,
'aggregations': {
'my_date_histogram': {
'buckets': [
{
'doc_count': 1,
'key': 1480392360000,
'key_as_string': '2016-11-29T04:06:00.000Z',
'f1': {'value': 0.1},
},
{
'doc_count': 1,
'key': 1480392420000,
'key_as_string': '2016-11-29T04:07:00.000Z',
'f1': {'value': 0.2},
def test_agg_buckets(self):
agg = Agg()
agg._result_dict = {
'took': 1,
'aggregations': {
'agg_key': {
'buckets': [
{
'key': 'a',
'f1': {'value': 100},
'f2': {'value': 1},
"doc_count": 12
},
{
'key': 'b',
'f1': {'value': 200},
'f2': {'value': 2},
"doc_count": 13
def test_agg_nested_buckets(self):
agg = Agg()
agg._result_dict = {
'aggregations': {
'agg_key1': {
'buckets': [
{
'key': 'a',
'agg_key2': {
'buckets': [
{
'key': 'x',
'f1': {'value': 100},
'f2': {'value': 1},
"doc_count": 934422
},
{
'key': 'y',
def test_agg_buckets(self):
agg = Agg()
agg._result_dict = {
'aggregations': {
'agg_key': {
'buckets': [
{
'key': 'a',
'f1': {'value': 100},
'f2': {'value': 1},
"doc_count": 934422
},
{
'key': 'b',
'f1': {'value': 200},
'f2': {'value': 2},
"doc_count": 934422
},
def test_agg_nested_buckets(self):
agg = Agg()
agg._result_dict = {
'took': 1,
'aggregations': {
'agg_key1': {
'buckets': [
{
'key': 'a',
'agg_key2': {
'buckets': [
{
'key': 'x',
'f1': {'value': 100},
'f2': {'value': 1},
"doc_count": 11
},
{
def from_dict(d):
agg = Agg()
agg.explain_result(d)
return agg
def __init__(self):
super(Agg, self).__init__()
self._index_names = None
self._indexes = None