<commit_before>from bpython import importcompletion

import unittest

class TestSimpleComplete(unittest.TestCase):
    def setUp(self):
        self.original_modules = importcompletion.modules
        importcompletion.modules = ['zzabc', 'zzabd', 'zzefg', 'zzabc.e', 'zzabc.f']
    def tearDown(self):
        importcompletion.modules = self.original_modules
    def test_simple_completion(self):
        self.assertEqual(importcompletion.complete(10, 'import zza'), ['zzabc', 'zzabd'])
    def test_package_completion(self):
        self.assertEqual(importcompletion.complete(13, 'import zzabc.'), ['zzabc.e', 'zzabc.f', ])


class TestRealComplete(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        [_ for _ in importcompletion.find_iterator]
        __import__('sys')
        __import__('os')
    @classmethod
    def tearDownClass(cls):
        importcompletion.find_iterator = importcompletion.find_all_modules()
        importcompletion.modules = set()
    def test_from_attribute(self):
        self.assertEqual(importcompletion.complete(19, 'from sys import arg'), ['argv'])
    def test_from_attr_module(self):
        self.assertEqual(importcompletion.complete(9, 'from os.p'), ['os.path'])
    def test_from_package(self):
        self.assertEqual(importcompletion.complete(17, 'from xml import d'), ['dom'])


<commit_msg>Newlines<commit_after>from bpython import importcompletion

import unittest

class TestSimpleComplete(unittest.TestCase):

    def setUp(self):
        self.original_modules = importcompletion.modules
        importcompletion.modules = ['zzabc', 'zzabd', 'zzefg', 'zzabc.e', 'zzabc.f']

    def tearDown(self):
        importcompletion.modules = self.original_modules

    def test_simple_completion(self):
        self.assertEqual(importcompletion.complete(10, 'import zza'), ['zzabc', 'zzabd'])

    def test_package_completion(self):
        self.assertEqual(importcompletion.complete(13, 'import zzabc.'), ['zzabc.e', 'zzabc.f', ])


class TestRealComplete(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        [_ for _ in importcompletion.find_iterator]
        __import__('sys')
        __import__('os')

    @classmethod
    def tearDownClass(cls):
        importcompletion.find_iterator = importcompletion.find_all_modules()
        importcompletion.modules = set()

    def test_from_attribute(self):
        self.assertEqual(importcompletion.complete(19, 'from sys import arg'), ['argv'])

    def test_from_attr_module(self):
        self.assertEqual(importcompletion.complete(9, 'from os.p'), ['os.path'])

    def test_from_package(self):
        self.assertEqual(importcompletion.complete(17, 'from xml import d'), ['dom'])


{'fraction_non_alphanumeric': 0.12403100775193798, 'fraction_numerical': 0.006644518272425249, 'mean_word_length': 4.0278293135436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1065651', 'n_tokens_mistral': 830, 'n_tokens_neox': 776, 'n_words': 150}