<commit_before># coding=utf-8
"""
Various unicode handling related tests.

"""
from tests import http, httpbin, HTTP_OK
from tests.fixtures import UNICODE


class TestUnicode:

    def test_unicode_headers(self):
        r = http('--verbose', httpbin('/headers'), u'Test:%s' % UNICODE)
        assert HTTP_OK in r
        assert r.json['headers']['Test'] == UNICODE

    def test_unicode_headers_verbose(self):
        r = http('--verbose', httpbin('/headers'), u'Test:%s' % UNICODE)
        assert HTTP_OK in r
        assert UNICODE in r

    def test_unicode_form_item(self):
        r = http('--form', 'POST', httpbin('/post'), u'test=%s' % UNICODE)
        assert HTTP_OK in r
        assert r.json['form'] == {'test': UNICODE}

    def test_unicode_form_item_verbose(self):
        r = http('--verbose', '--form',
                 'POST', httpbin('/post'), u'test=%s' % UNICODE)
        assert HTTP_OK in r
        assert UNICODE in r

    def test_unicode_json_item(self):
        r = http('--json', 'POST', httpbin('/post'), u'test=%s' % UNICODE)
        assert HTTP_OK in r
        assert r.json['json'] == {'test': UNICODE}

    def test_unicode_json_item_verbose(self):
        r = http('--verbose', '--json',
                 'POST', httpbin('/post'), u'test=%s' % UNICODE)
        assert HTTP_OK in r
        assert UNICODE in r

    def test_unicode_raw_json_item(self):
        r = http('--verbose',
                 '--json', 'POST', httpbin('/post'),
                 u'test:={ "%s" : [ "%s" ] }' % (UNICODE, UNICODE))

    def test_unicode_raw_json_item_verbose(self):
        r = http('--verbose',
                 '--json', 'POST', httpbin('/post'),
                 u'test:={ "%s" : [ "%s" ] }' % (UNICODE, UNICODE))
        assert HTTP_OK in r
        assert UNICODE in r

    def test_unicode_url_query_arg_item(self):
        r = http(httpbin('/get'), u'test==%s' % UNICODE)
        assert HTTP_OK in r
        assert r.json['args'] == {'test': UNICODE}, r

    def test_unicode_url_query_arg_item_verbose(self):<commit_msg>Fixed tests.<commit_after># coding=utf-8
"""
Various unicode handling related tests.

"""
from tests import http, httpbin, HTTP_OK
from tests.fixtures import UNICODE


class TestUnicode:

    def test_unicode_headers(self):
        r = http(httpbin('/headers'), u'Test:%s' % UNICODE)
        assert HTTP_OK in r
        assert r.json['headers']['Test'] == UNICODE

    def test_unicode_headers_verbose(self):
        r = http('--verbose', httpbin('/headers'), u'Test:%s' % UNICODE)
        assert HTTP_OK in r
        assert UNICODE in r

    def test_unicode_form_item(self):
        r = http('--form', 'POST', httpbin('/post'), u'test=%s' % UNICODE)
        assert HTTP_OK in r
        assert r.json['form'] == {'test': UNICODE}

    def test_unicode_form_item_verbose(self):
        r = http('--verbose', '--form',
                 'POST', httpbin('/post'), u'test=%s' % UNICODE)
        assert HTTP_OK in r
        assert UNICODE in r

    def test_unicode_json_item(self):
        r = http('--json', 'POST', httpbin('/post'), u'test=%s' % UNICODE)
        assert HTTP_OK in r
        assert r.json['json'] == {'test': UNICODE}

    def test_unicode_json_item_verbose(self):
        r = http('--verbose', '--json',
                 'POST', httpbin('/post'), u'test=%s' % UNICODE)
        assert HTTP_OK in r
        assert UNICODE in r

    def test_unicode_raw_json_item(self):
        r = http('--json', 'POST', httpbin('/post'),
                 u'test:={ "%s" : [ "%s" ] }' % (UNICODE, UNICODE))
        assert r.json['json'] == {'test': {UNICODE: [UNICODE]}}

    def test_unicode_raw_json_item_verbose(self):
        r = http('--verbose',
                 '--json', 'POST', httpbin('/post'),
                 u'test:={ "%s" : [ "%s" ] }' % (UNICODE, UNICODE))
        assert HTTP_OK in r
        assert UNICODE in r

    def test_unicode_url_query_arg_item(self):
        r = http(httpbin('/get'), u'test==%s' % UNICODE)
        assert HTTP_OK in r
        assert r.json['args'] == {'test': UNICODE}, r

    def test_unicode_url_query_arg_item_verbose(self):
{'fraction_non_alphanumeric': 0.16132167152575316, 'fraction_numerical': 0.00048590864917395527, 'mean_word_length': 2.5098039215686274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3180645', 'n_tokens_mistral': 1433, 'n_tokens_neox': 1346, 'n_words': 329}