# Path: pyeqs/dsl/script_score.py
# class ScriptScore(dict):
# 
#     def __init__(self, script, params=None, lang=None):
#         super(ScriptScore, self).__init__()
#         self.script = script
#         self.params = params
#         self.lang = lang
#         self._build_dict()
# 
#     def _build_dict(self):
#         self["script"] = self.script
#         if self.params:
#             self["params"] = self.params
#         if self.lang:
#             self["lang"] = self.lang
# 
# 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 ScriptScore
from tests.helpers import homogeneous
    Create Score Block with Language
    """
    # When add a Score field
    t = ScriptScore("foo", lang="mvel")

    # Then I see the appropriate JSON
    results = {
        "script": "foo",
        "lang": "mvel"
    }

    homogeneous(t, results)


def test_add_score_with_params_and_lang():
    """
    Create Score Block with Params and Language
    """
    # When add a Score field
    t = ScriptScore("foo", params={"bar": "baz"}, lang="mvel")

    # Then I see the appropriate JSON
    results = {
        "script": "foo",
        "params": {
            "bar": "baz"
        },
        "lang": "mvel"
    }


# Path: pyeqs/dsl/script_score.py
# class ScriptScore(dict):
# 
#     def __init__(self, script, params=None, lang=None):
#         super(ScriptScore, self).__init__()
#         self.script = script
#         self.params = params
#         self.lang = lang
#         self._build_dict()
# 
#     def _build_dict(self):
#         self["script"] = self.script
#         if self.params:
#             self["params"] = self.params
#         if self.lang:
#             self["lang"] = self.lang
# 
# 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_score.py
from pyeqs.dsl import ScriptScore
from tests.helpers import homogeneous

    Create Score Block with Language
    """
    # When add a Score field
    t = ScriptScore("foo", lang="mvel")

    # Then I see the appropriate JSON
    results = {
        "script": "foo",
        "lang": "mvel"
    }

    homogeneous(t, results)


def test_add_score_with_params_and_lang():
    """
    Create Score Block with Params and Language
    """
    # When add a Score field
    t = ScriptScore("foo", params={"bar": "baz"}, lang="mvel")

    # Then I see the appropriate JSON
    results = {
        "script": "foo",
        "params": {
            "bar": "baz"
        },
        "lang": "mvel"
    }


    homogeneous(t, results)