<commit_before>import unittest
from graphite_influxdb.classes.tree import IndexTree
from graphite_influxdb.utils import Query
import datetime

class IndexTreeTestCase(unittest.TestCase):

    def setUp(self):
        # all_series = [
        #     'root.branch%s.branch%s.branch%s.branch%s.leaf%s' % (b1, b2, b3, b4, n,)
        #     for b1 in xrange(1,5)
        #     for b2 in xrange(1,5)
        #     for b3 in xrange(1,5)
        #     for b4 in xrange(1,5)
        #     for n in xrange(1,5)]
        all_series = ['b1.b1.b1.b1.leaf1',
                      'b1.b1.b1.b2.leaf1',
                      'b1.b1.b2.b2.leaf1',
                      'b1.b1.b1.b1.leaf2',
                      'b1.b1.b1.b2.leaf2',
                      'b1.b1.b2.b2.leaf2'
                      ]
        self.index = IndexTree(all_series, None)
    
    def test_root_wildcard(self):
        query = '*'
        result = list(self.index.search(query))
        print result
        import ipdb; ipdb.set_trace()<commit_msg>Updated index tree unittests<commit_after>import unittest
from graphite_influxdb.classes.tree import NodeTreeIndex
from graphite_influxdb.utils import Query
import datetime

class IndexTreeTestCase(unittest.TestCase):

    def setUp(self):
        all_series = ['b1.b1.b1.b1.leaf1',
                      'b1.b1.b1.b2.leaf1',
                      'b1.b1.b2.b2.leaf1',
                      'b1.b1.b1.b1.leaf2',
                      'b1.b1.b1.b2.leaf2',
                      'b1.b1.b2.b2.leaf2'
                      ]
        self.index = NodeTreeIndex()
        for serie in all_series:
            self.index.insert(serie)
    
    def test_root_wildcard(self):
        result = list(self.index.query('*'))
        self.assertTrue(len(result) == 1)
        self.assertTrue(result[0]['metric'] == 'b1')
        result = list(self.index.query('b1.*'))
        self.assertTrue(len(result) == 1)
        self.assertTrue(result[0]['metric'] == 'b1.b1')
        result = list(self.index.query('b1.b1.*'))
        self.assertTrue(len(result) == 2)
        self.assertTrue(result[0]['metric'] == 'b1.b1.b1')
        self.assertTrue(result[1]['metric'] == 'b1.b1.b2')
        result = list(self.index.query('b1.b1.*.*'))
        self.assertTrue(len(result) == 3)
        self.assertTrue(result[0]['metric'] == 'b1.b1.b1.b1')
        self.assertTrue(result[1]['metric'] == 'b1.b1.b1.b2')
        self.assertTrue(result[2]['metric'] == 'b1.b1.b2.b2')
        result = list(self.index.query('b1.b1.*.*.*'))
        self.assertTrue(len(result) == 6)
        self.assertTrue(result[0]['metric'] == 'b1.b1.b1.b1.leaf1')
        self.assertTrue(result[1]['metric'] == 'b1.b1.b1.b1.leaf2')
        self.assertTrue(result[2]['metric'] == 'b1.b1.b1.b2.leaf1')
        self.assertTrue(result[3]['metric'] == 'b1.b1.b1.b2.leaf2')
        self.assertTrue(result[4]['metric'] == 'b1.b1.b2.b2.leaf1')
        self.assertTrue(result[5]['metric'] == 'b1.b1.b2.b2.leaf2')
        result = list(self.index.query('b1.b1.*.*.{leaf1,leaf2}'))
        self.assertTrue(len(result) == 6)
        self.assertTrue(result[0]['metric'] == 'b1.b1.b1.b1.leaf1')
        self.assertTrue(result[1]['metric'] == 'b1.b1.b1.b1.leaf2')
        self.assertTrue(result[2]['metric'] == 'b1.b1.b1.b2.leaf1')
        self.assertTrue(result[3]['metric'] == 'b1.b1.b1.b2.leaf2')
        self.assertTrue(result[4]['metric'] == 'b1.b1.b2.b2.leaf1')
        self.assertTrue(result[5]['metric'] == 'b1.b1.b2.b2.leaf2')
        result = list(self.index.query('fakey*'))
        self.assertFalse(result)
{'fraction_non_alphanumeric': 0.1796457689063818, 'fraction_numerical': 0.054821478774247964, 'mean_word_length': 2.1796246648793565, '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': '6302151', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1345, 'n_words': 162}