# Path: pyeqs/dsl/missing.py
# class Missing(dict):
# 
#     def __init__(self, field, existence=None, null_value=None):
#         super(Missing, self).__init__()
#         self.field = field
#         self.existence = existence
#         self.null_value = null_value
#         self["missing"] = self._build_dict()
# 
#     def _build_dict(self):
#         missing = {"field": self.field}
#         if self.existence is not None:
#             missing["existence"] = self.existence
#         if self.null_value is not None:
#             missing["null_value"] = self.null_value
#         return missing
# 
# Path: tests/helpers.py
# def homogeneous(a, b):
#     json.dumps(a, sort_keys=True).should.equal(json.dumps(b, sort_keys=True))


from pyeqs.dsl import Missing
from tests.helpers import homogeneous
# -*- coding: utf-8 -*-
from __future__ import unicode_literals



def test_missing():
    """
    Create Missing Block
    """
    # When add a Missing Block
    t = Missing("foo")

    # Then I see the appropriate JSON
    results = {
        "missing": {
            "field": "foo"
        }
    }

    homogeneous(t, results)


def test_missing_existence():
    """
    Create Missing Block with Existence
    """
    # When add a Missing Block

# Path: pyeqs/dsl/missing.py
# class Missing(dict):
# 
#     def __init__(self, field, existence=None, null_value=None):
#         super(Missing, self).__init__()
#         self.field = field
#         self.existence = existence
#         self.null_value = null_value
#         self["missing"] = self._build_dict()
# 
#     def _build_dict(self):
#         missing = {"field": self.field}
#         if self.existence is not None:
#             missing["existence"] = self.existence
#         if self.null_value is not None:
#             missing["null_value"] = self.null_value
#         return missing
# 
# Path: tests/helpers.py
# def homogeneous(a, b):
#     json.dumps(a, sort_keys=True).should.equal(json.dumps(b, sort_keys=True))


# Path: tests/unit/test_missing.py
from pyeqs.dsl import Missing
from tests.helpers import homogeneous

# -*- coding: utf-8 -*-
from __future__ import unicode_literals



def test_missing():
    """
    Create Missing Block
    """
    # When add a Missing Block
    t = Missing("foo")

    # Then I see the appropriate JSON
    results = {
        "missing": {
            "field": "foo"
        }
    }

    homogeneous(t, results)


def test_missing_existence():
    """
    Create Missing Block with Existence
    """
    # When add a Missing Block

    t = Missing("foo", existence=True)