Exemple #1
0
    def test_json(self):
        """

        :return:
        """

        data = {'a': 1, 'b': 'hello', 'c': True, 'd': date(2016, 9, 9)}

        result = render.json(hello=data)
        self.assertGreater(len(result), 1)
Exemple #2
0
def json(**kwargs):
    """
    Adds the specified data to the the output display window with the
    specified key. This allows the user to make available arbitrary
    JSON-compatible data to the display for runtime use.

    :param kwargs:
        Each keyword argument is added to the CD.data object with the
        specified key and value.
    """

    r = _get_report()
    r.append_body(render.json(**kwargs))
Exemple #3
0
def json(**kwargs):
    """
    Adds the specified data to the the output display window with the
    specified key. This allows the user to make available arbitrary
    JSON-compatible data to the display for runtime use.

    :param kwargs:
        Each keyword argument is added to the CD.data object with the
        specified key and value.
    """
    r = _get_report()
    r.append_body(render.json(**kwargs))
    r.stdout_interceptor.write_source('{}\n'.format(
        _json_io.dumps(kwargs, indent=2)))
Exemple #4
0
def json(**kwargs):
    """
    Adds the specified data to the the output display window with the
    specified key. This allows the user to make available arbitrary
    JSON-compatible data to the display for runtime use.

    :param kwargs:
        Each keyword argument is added to the CD.data object with the
        specified key and value.
    """
    r = _get_report()
    r.append_body(render.json(**kwargs))
    r.stdout_interceptor.write_source(
        '{}\n'.format(_json_io.dumps(kwargs, indent=2))
    )
Exemple #5
0
    def test_json(self):
        """Should inject JSON into body"""

        data = {'a': 1, 'b': 'hello', 'c': True, 'd': date(2016, 9, 9)}
        result = render.json(hello=data)
        self.assertGreater(len(result), 1)
Exemple #6
0
    def test_json(self):
        """Should inject JSON into body"""

        data = {'a': 1, 'b': 'hello', 'c': True, 'd': date(2016, 9, 9)}
        result = render.json(hello=data)
        self.assertGreater(len(result), 1)