<commit_before>"""Tests for trie data structure."""


import pytest


def test_trie():
    pass<commit_msg>added some tests to start and fixtures<commit_after>"""Tests for trie data structure."""

import pytest


@pytest.fixture
def empty_trie():
    """Fixture for empty trie."""
    from trie import Trie
    empty = Trie()
    reutn empty


@pytest.fixture
def simple_trie():
    """Fixture for simple trie."""
    from trie import Trie    
    simple = Trie()
    simple.insert('a')
    return simple


@pytest.fixture
def trie():
    """Fixture for a trie.""" 
    trie = Trie()
    words = ['into', 'int', 'it', 'tea', 'ted', 'ten', 'to']
    for word in words:
        trie.insert(word)
    return trie


def test_init_creates_empty_trie(empty_trie):
    """Test empty nodes on empty tree."""
    assert empty_trie._nodes = {'': set()}


def test_contains(trie):
    """Test contains method is true for word in tree."""
    assert trie.contains('into')


def test_contains_false(simple_trie):
    """Test contains is false when not in the trie."""
    assert not simple_trie.contains('potato')


def test_contains_string(trie):
    """Test if trie contains a string that isn't a word."""
    assert simple_trie.contains('in')


def test_insert_adds_keys(empty_trie):
    """Test insert on an empty tree adds length."""
    empty_trie.insert('hello')
    assert len(empty_trie._nodes) == 6


def test_insert_adds_keys_add_end(empty_trie):
    """Test insert on an empty tree adds a word ender."""
    empty_trie.insert('hello')
    assert '$' in empty_trie._nodes.values()


def test_insert_adds_each_letter(empty_trie):
    """Test insert on an empty tree adds each leter."""
    empty_trie.insert('hi')
    assert 'h' in empty_trie._nodes.keys()
    assert 'hi' in empty_trie._nodes.keys()


{'fraction_non_alphanumeric': 0.13007226236798222, 'fraction_numerical': 0.0005558643690939411, 'mean_word_length': 3.6153846153846154, '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': '758900', 'n_tokens_mistral': 606, 'n_tokens_neox': 594, 'n_words': 179}