<commit_before>from bpython import autocomplete

import unittest
try:
    from unittest import skip
except ImportError:
    def skip(f):
        return lambda self: None

#TODO: Parts of autocompletion to test:
# Test that the right matches come back from find_matches (test that priority is correct)
# Test the various complete methods (import, filename) to see if right matches
# Test that MatchesIterator.substitute correctly subs given a match and a completer

class TestSafeEval(unittest.TestCase):
    def test_catches_syntax_error(self):
        with self.assertRaises(autocomplete.EvaluationError):
            autocomplete.safe_eval('1re',{})


class TestFormatters(unittest.TestCase):

    def test_filename(self):<commit_msg>Make test work under Python 2.6.<commit_after>from bpython import autocomplete

import unittest
try:
    from unittest import skip
except ImportError:
    def skip(f):
        return lambda self: None

#TODO: Parts of autocompletion to test:
# Test that the right matches come back from find_matches (test that priority is correct)
# Test the various complete methods (import, filename) to see if right matches
# Test that MatchesIterator.substitute correctly subs given a match and a completer

class TestSafeEval(unittest.TestCase):
    def test_catches_syntax_error(self):
        self.assertRaises(autocomplete.EvaluationError,
                          autocomplete.safe_eval, '1re', {})


class TestFormatters(unittest.TestCase):

    def test_filename(self):
{'fraction_non_alphanumeric': 0.06462358427714857, 'fraction_numerical': 0.002664890073284477, 'mean_word_length': 4.270175438596492, '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': '7536592', 'n_tokens_mistral': 416, 'n_tokens_neox': 397, 'n_words': 150}