<commit_before>from __future__ import absolute_import, division, unicode_literals
import os
import io
import socket
import array
import sys

from future.standard_library import import_
from future.standard_library.test import support
import future.standard_library.urllib.request as urllib_request
# The proxy bypass method imported below has logic specific to the OSX
# proxy config data structure but is testable on all platforms.
from future.standard_library.urllib.request import Request, OpenerDirector, _proxy_bypass_macosx_sysconf
import future.standard_library.urllib.error as urllib_error
from future.tests.base import unittest
from future.builtins import bytes, dict, int, open, str, zip
from future.utils import text_to_native_str


# XXX
# Request
# CacheFTPHandler (hard to write)
# parse_keqv_list, parse_http_list, HTTPDigestAuthHandler

class TrivialTests(unittest.TestCase):

    def test___all__(self):
        # Verify which names are exposed
        for module in 'request', 'response', 'parse', 'error', 'robotparser':
            context = {}
            exec('from future.standard_library.urllib.%s import *' % module, context)
            del context['__builtins__']
            if module == 'request' and os.name == 'nt':
                u, p = context.pop('url2pathname'), context.pop('pathname2url')
                self.assertEqual(u.__module__, 'nturl2path')
                self.assertEqual(p.__module__, 'nturl2path')
            for k, v in context.items():
                self.assertEqual(v.__module__, 'future.standard_library.urllib.%s' % module,
                    "%r is exposed in 'future.standard_library.urllib.%s' but defined in %r" %
                    (k, module, v.__module__))<commit_msg>Create alias base64.encodebytes() in test_urllib2<commit_after>from __future__ import absolute_import, division, unicode_literals
import os
import io
import socket
import array
import sys

from future.standard_library import import_, install_aliases
from future.standard_library.test import support
import future.standard_library.urllib.request as urllib_request
# The proxy bypass method imported below has logic specific to the OSX
# proxy config data structure but is testable on all platforms.
from future.standard_library.urllib.request import Request, OpenerDirector, _proxy_bypass_macosx_sysconf
import future.standard_library.urllib.error as urllib_error
from future.tests.base import unittest
from future.builtins import bytes, dict, int, open, str, zip
from future.utils import text_to_native_str

install_aliases()   # for base64.encodebytes on Py2


# XXX
# Request
# CacheFTPHandler (hard to write)
# parse_keqv_list, parse_http_list, HTTPDigestAuthHandler

class TrivialTests(unittest.TestCase):

    def test___all__(self):
        # Verify which names are exposed
        for module in 'request', 'response', 'parse', 'error', 'robotparser':
            context = {}
            exec('from future.standard_library.urllib.%s import *' % module, context)
            del context['__builtins__']
            if module == 'request' and os.name == 'nt':
                u, p = context.pop('url2pathname'), context.pop('pathname2url')
                self.assertEqual(u.__module__, 'nturl2path')
                self.assertEqual(p.__module__, 'nturl2path')
            for k, v in context.items():
                self.assertEqual(v.__module__, 'future.standard_library.urllib.%s' % module,
                    "%r is exposed in 'future.standard_library.urllib.%s' but defined in %r" %
                    (k, module, v.__module__))
{'fraction_non_alphanumeric': 0.08664058133035216, 'fraction_numerical': 0.003912800447177194, 'mean_word_length': 3.524652338811631, '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': '2857459', 'n_tokens_mistral': 1021, 'n_tokens_neox': 998, 'n_words': 299}