<commit_before># -*- coding: utf-8 -*-
#
# © 2010, 2011 SimpleGeo, Inc. All rights reserved.
# Author: <NAME> <<EMAIL>>
#

"""Tests for Dream."""

import sys
import unittest
import traceback
import json

from webob.multidict import UnicodeMultiDict
from dream import (App, Request, Response, JSONResponse,
                   HumanReadableJSONResponse, exc,
                   endpoints, hidden, _exception_to_response,
                   _debug_exception_to_reponse, _format_traceback)


def _env(**kwargs):
    """Return a stub WSGI environment."""
    return dict({'wsgi.url_scheme': 'http',
            'SERVER_NAME': 'localhost',
            'SERVER_PORT': 80,
            'REQUEST_METHOD': 'GET',
            'PATH_INFO': '/'
            }, **kwargs)


class JSONResponseTest(unittest.TestCase):

    """Test the JSONResponse."""<commit_msg>Add missing SERVER_PROTOCOL to _env() helper.<commit_after># -*- coding: utf-8 -*-
#
# © 2010, 2011 SimpleGeo, Inc. All rights reserved.
# Author: <NAME> <<EMAIL>>
#

"""Tests for Dream."""

import sys
import unittest
import traceback
import json

from webob.multidict import UnicodeMultiDict
from dream import (App, Request, Response, JSONResponse,
                   HumanReadableJSONResponse, exc,
                   endpoints, hidden, _exception_to_response,
                   _debug_exception_to_reponse, _format_traceback)


def _env(**kwargs):
    """Return a stub WSGI environment."""
    return dict({'wsgi.url_scheme': 'http',
                 'SERVER_NAME': 'localhost',
                 'SERVER_PORT': 80,
                 'SERVER_PROTOCOL': 'HTTP/1.1',
                 'REQUEST_METHOD': 'GET',
                 'PATH_INFO': '/'
                 }, **kwargs)


class JSONResponseTest(unittest.TestCase):

    """Test the JSONResponse."""
{'fraction_non_alphanumeric': 0.12520868113522537, 'fraction_numerical': 0.01335559265442404, 'mean_word_length': 2.588822355289421, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1042222', 'n_tokens_mistral': 539, 'n_tokens_neox': 500, 'n_words': 138}