<commit_before>import uuid
from django.test import SimpleTestCase, override_settings
from corehq.elastic import get_es_new
from corehq.util.elastic import TEST_ES_PREFIX
from pillowtop.es_utils import get_all_elasticsearch_pillow_classes, get_all_inferred_es_indices_from_pillows, \
    ElasticsearchIndexInfo, create_index_and_set_settings_normal
from pillowtop.tests.utils import TestElasticPillow


class ElasticReindexTest(SimpleTestCase):

    @classmethod
    def setUpClass(cls):
        cls.elasticsearch = get_es_new()

    @override_settings(PILLOWTOPS={'test': ['pillowtop.tests.FakePillow']})
    def test_get_all_elastic_pillows_no_match(self):
        self.assertEqual(0, len(get_all_elasticsearch_pillow_classes()))

    @override_settings(PILLOWTOPS={'test': ['pillowtop.tests.test_elasticsearch.TestElasticPillow']})
    def test_get_all_elastic_pillows_match(self):
        es_pillow_classes = get_all_elasticsearch_pillow_classes()
        self.assertEqual(1, len(es_pillow_classes))
        self.assertEqual(TestElasticPillow, es_pillow_classes[0])

    @override_settings(PILLOWTOPS={'test': ['pillowtop.tests.test_elasticsearch.TestElasticPillow']})
    def test_get_all_elastic_indices(self):
        es_indices = list(get_all_inferred_es_indices_from_pillows())
        self.assertEqual(1, len(es_indices))
        index_info = es_indices[0]
        self.assertEqual(TestElasticPillow.es_index, index_info.index)
        self.assertEqual(TestElasticPillow.es_alias, index_info.alias)
        self.assertEqual(TestElasticPillow.es_type, index_info.type)<commit_msg>rename test<commit_after>import uuid
from django.test import SimpleTestCase, override_settings
from corehq.elastic import get_es_new
from corehq.util.elastic import TEST_ES_PREFIX
from pillowtop.es_utils import get_all_elasticsearch_pillow_classes, get_all_inferred_es_indices_from_pillows, \
    ElasticsearchIndexInfo, create_index_and_set_settings_normal
from pillowtop.tests.utils import TestElasticPillow


class ElasticReindexTest(SimpleTestCase):

    @classmethod
    def setUpClass(cls):
        cls.elasticsearch = get_es_new()

    @override_settings(PILLOWTOPS={'test': ['pillowtop.tests.FakePillow']})
    def test_get_all_elastic_pillows_no_match(self):
        self.assertEqual(0, len(get_all_elasticsearch_pillow_classes()))

    @override_settings(PILLOWTOPS={'test': ['pillowtop.tests.test_elasticsearch.TestElasticPillow']})
    def test_get_all_elastic_pillows_match(self):
        es_pillow_classes = get_all_elasticsearch_pillow_classes()
        self.assertEqual(1, len(es_pillow_classes))
        self.assertEqual(TestElasticPillow, es_pillow_classes[0])

    @override_settings(PILLOWTOPS={'test': ['pillowtop.tests.test_elasticsearch.TestElasticPillow']})
    def test_get_all_elastic_indices_from_pillows(self):
        es_indices = list(get_all_inferred_es_indices_from_pillows())
        self.assertEqual(1, len(es_indices))
        index_info = es_indices[0]
        self.assertEqual(TestElasticPillow.es_index, index_info.index)
        self.assertEqual(TestElasticPillow.es_alias, index_info.alias)
        self.assertEqual(TestElasticPillow.es_type, index_info.type)
{'fraction_non_alphanumeric': 0.08597427047379981, 'fraction_numerical': 0.0031377470975839346, 'mean_word_length': 5.930434782608696, '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': '2271604', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1061, 'n_words': 130}