<commit_before># Module:   test_version
# Date:     17th March 2009
# Author:   <NAME>, prologic at shortcircuit dot net dot au

"""Version Test Suite"""

import os
import unittest
from os import path
from os.path import abspath, dirname
from subprocess import Popen, call, PIPE

class TestVersion(unittest.TestCase):
    """Test Version

    Test the version of circuits that is generated.
    """

    def runTest(self):
        root = abspath("%s/../" % dirname(abspath(__file__)))

        if path.exists(path.join(root, "__version__.py")):
            os.remove(path.join(root, "__version__.py"))
        if path.exists(path.join(root, "__version__.pyc")):
            os.remove(path.join(root, "__version__.pyc"))

        import circuits

        self.assertEquals(circuits.__version__, "unknown")

        from circuits import version
        version.forget_version()
        version.remember_version()

        root = abspath("%s/../" % root)

        cwd = os.getcwd()
        os.chdir(root)

        if path.exists(path.join(root, ".hg")):
            call("python setup.py build &> /dev/null", shell=True)

        reload(circuits)

        p = Popen(["hg id -i"], stdout=PIPE, shell=True)
        id = p.communicate()[0].strip()

        self.assertEquals(circuits.__version__, id)

        os.chdir(cwd)

if __name__ == "__main__":
    unittest.main()<commit_msg>tests.test_version: Do a right stirp of '\n+' on version id returend by mercurial.<commit_after># Module:   test_version
# Date:     17th March 2009
# Author:   <NAME>, prologic at shortcircuit dot net dot au

"""Version Test Suite"""

import os
import unittest
from os import path
from os.path import abspath, dirname
from subprocess import Popen, call, PIPE

class TestVersion(unittest.TestCase):
    """Test Version

    Test the version of circuits that is generated.
    """

    def runTest(self):
        root = abspath("%s/../" % dirname(abspath(__file__)))

        if path.exists(path.join(root, "__version__.py")):
            os.remove(path.join(root, "__version__.py"))
        if path.exists(path.join(root, "__version__.pyc")):
            os.remove(path.join(root, "__version__.pyc"))

        import circuits

        self.assertEquals(circuits.__version__, "unknown")

        from circuits import version
        version.forget_version()
        version.remember_version()

        root = abspath("%s/../" % root)

        cwd = os.getcwd()
        os.chdir(root)

        if path.exists(path.join(root, ".hg")):
            call("python setup.py build &> /dev/null", shell=True)

        reload(circuits)

        p = Popen(["hg id -i"], stdout=PIPE, shell=True)
        id = p.communicate()[0].rstrip("\n+")

        self.assertEquals(circuits.__version__, id)

        os.chdir(cwd)

if __name__ == "__main__":
    unittest.main()
{'fraction_non_alphanumeric': 0.13467656415694593, 'fraction_numerical': 0.00494874513962531, 'mean_word_length': 2.6897001303780965, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, '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': '5191528', 'n_tokens_mistral': 923, 'n_tokens_neox': 873, 'n_words': 221}