# Path: pyeqs/dsl/range.py
# class Range(dict):
# 
#     def __init__(self, field_name, gte=None, gt=None, lte=None, lt=None):
#         super(Range, self).__init__()
#         self.field_name = field_name
#         self.gte = gte
#         self.gt = gt
#         self.lte = lte
#         self.lt = lt
#         self["range"] = self._build_dict()
# 
#     def _build_dict(self):
#         _range = {
#                 self.field_name: {}
#             }
#         if self.gte:
#             _range[self.field_name]["gte"] = self.gte
#         if self.gt:
#             _range[self.field_name]["gt"] = self.gt
#         if self.lte:
#             _range[self.field_name]["lte"] = self.lte
#         if self.lt:
#             _range[self.field_name]["lt"] = self.lt
#         return _range
# 
# 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 Range
from tests.helpers import homogeneous
    t = Range("foo", lte="bar")

    # Then I see the appropriate JSON
    results = {
        "range": {
            "foo": {
                "lte": "bar"
            }
        }
    }

    homogeneous(t, results)


def test_add_lt_range():
    """
    Create Less Than Range Block
    """
    # When add a Range Block
    t = Range("foo", lt="bar")

    # Then I see the appropriate JSON
    results = {
        "range": {
            "foo": {
                "lt": "bar"
            }
        }
    }


# Path: pyeqs/dsl/range.py
# class Range(dict):
# 
#     def __init__(self, field_name, gte=None, gt=None, lte=None, lt=None):
#         super(Range, self).__init__()
#         self.field_name = field_name
#         self.gte = gte
#         self.gt = gt
#         self.lte = lte
#         self.lt = lt
#         self["range"] = self._build_dict()
# 
#     def _build_dict(self):
#         _range = {
#                 self.field_name: {}
#             }
#         if self.gte:
#             _range[self.field_name]["gte"] = self.gte
#         if self.gt:
#             _range[self.field_name]["gt"] = self.gt
#         if self.lte:
#             _range[self.field_name]["lte"] = self.lte
#         if self.lt:
#             _range[self.field_name]["lt"] = self.lt
#         return _range
# 
# 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_range.py
from pyeqs.dsl import Range
from tests.helpers import homogeneous

    t = Range("foo", lte="bar")

    # Then I see the appropriate JSON
    results = {
        "range": {
            "foo": {
                "lte": "bar"
            }
        }
    }

    homogeneous(t, results)


def test_add_lt_range():
    """
    Create Less Than Range Block
    """
    # When add a Range Block
    t = Range("foo", lt="bar")

    # Then I see the appropriate JSON
    results = {
        "range": {
            "foo": {
                "lt": "bar"
            }
        }
    }


    homogeneous(t, results)