<commit_before># -*- coding: UTF-8 -*-

"""develop tests
"""
import os
import shutil
import site
import sys
import tempfile
import unittest

from setuptools.compat import StringIO, PY2
from setuptools.command.test import test
from setuptools.dist import Distribution

SETUP_PY = """\
from setuptools import setup

setup(name='foo',
    packages=['name', 'name.space', 'name.space.tests'],
    namespace_packages=['name'],
    test_suite='name.space.tests.test_suite',
)
"""

NS_INIT = """# -*- coding: Latin-1 -*-
# Söme Arbiträry Ünicode to test Issüé 310
try:
    __import__('pkg_resources').declare_namespace(__name__)
except ImportError:
    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)
"""
# Make sure this is Latin-1 binary, before writing:
if PY2:
    NS_INIT = NS_INIT.decode('UTF-8')
NS_INIT = NS_INIT.encode('Latin-1')

TEST_PY = """import unittest

class TestTest(unittest.TestCase):
    def test_test(self):
        print "Foo" # Should fail under Python 3 unless 2to3 is used

test_suite = unittest.makeSuite(TestTest)
"""

class TestTestTest(unittest.TestCase):

    def setUp(self):
        if sys.version < "2.6" or hasattr(sys, 'real_prefix'):
            return

        # Directory structure
        self.dir = tempfile.mkdtemp()
        os.mkdir(os.path.join(self.dir, 'name'))
        os.mkdir(os.path.join(self.dir, 'name', 'space'))
        os.mkdir(os.path.join(self.dir, 'name', 'space', 'tests'))
        # setup.py
        setup = os.path.join(self.dir, 'setup.py')
        f = open(setup, 'wt')
        f.write(SETUP_PY)
        f.close()
        self.old_cwd = os.getcwd()
        # name/__init__.py
        init = os.path.join(self.dir, 'name', '__init__.py')<commit_msg>Use DALS for nicer indentation<commit_after># -*- coding: UTF-8 -*-

"""develop tests
"""
import os
import shutil
import site
import sys
import tempfile
import unittest

from setuptools.compat import StringIO, PY2
from setuptools.command.test import test
from setuptools.dist import Distribution

from .textwrap import DALS

SETUP_PY = DALS("""
    from setuptools import setup

    setup(name='foo',
        packages=['name', 'name.space', 'name.space.tests'],
        namespace_packages=['name'],
        test_suite='name.space.tests.test_suite',
    )
    """)

NS_INIT = DALS("""
    # -*- coding: Latin-1 -*-
    # Söme Arbiträry Ünicode to test Issüé 310
    try:
        __import__('pkg_resources').declare_namespace(__name__)
    except ImportError:
        from pkgutil import extend_path
        __path__ = extend_path(__path__, __name__)
    """)

# Make sure this is Latin-1 binary, before writing:
if PY2:
    NS_INIT = NS_INIT.decode('UTF-8')
NS_INIT = NS_INIT.encode('Latin-1')

TEST_PY = DALS("""
    import unittest

    class TestTest(unittest.TestCase):
        def test_test(self):
            print "Foo" # Should fail under Python 3 unless 2to3 is used

    test_suite = unittest.makeSuite(TestTest)
    """)


class TestTestTest(unittest.TestCase):

    def setUp(self):
        if sys.version < "2.6" or hasattr(sys, 'real_prefix'):
            return

        # Directory structure
        self.dir = tempfile.mkdtemp()
        os.mkdir(os.path.join(self.dir, 'name'))
        os.mkdir(os.path.join(self.dir, 'name', 'space'))
        os.mkdir(os.path.join(self.dir, 'name', 'space', 'tests'))
        # setup.py
        setup = os.path.join(self.dir, 'setup.py')
        f = open(setup, 'wt')
        f.write(SETUP_PY)
        f.close()
        self.old_cwd = os.getcwd()
        # name/__init__.py
        init = os.path.join(self.dir, 'name', '__init__.py')
{'fraction_non_alphanumeric': 0.13756906077348066, 'fraction_numerical': 0.008287292817679558, 'mean_word_length': 2.987885462555066, 'pattern_counts': {'":': 0, '<': 5, '<?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': '750730', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1197, 'n_words': 282}