<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals

from linked_list import LinkedList, Node
import pytest


@pytest.fixture
def full_list():
    list = LinkedList()
    list.insert(True)
    list.insert('a string')
    list.insert(5)
    list.insert(10)
    return list


def test_node_init():
    node = Node(5)
    assert node.value == 5
    assert node.next is None


def test_node_bad_init():
    with pytest.raises(TypeError):
        node = Node(24, 'blah', 'blah')


def test_empty_list():
    list = LinkedList()
    assert isinstance(list, LinkedList)
    assert list.head is None


def test_insert():
    list = LinkedList()
    list.insert(5)
    assert list.head.value == 5


def test_size(full_list):
    assert full_list.size == 4


def test_list_init_iterable():
    list = LinkedList([5, True, 'string'])
    assert list.head.value == 'string'
    assert list.size == 3
    assert list.search(True).value is True


def test_list_init_not_iterable():
    with pytest.raises(TypeError):
        list = LinkedList(534)


def test_pop(full_list):
    assert full_list.pop() == 10
    assert full_list.size == 3


def test_pop_empty_list():
    list = LinkedList()
    with pytest.raises(IndexError):
        list.pop()


def test_search(full_list):
    assert full_list.search(5).value == 5


def test_search_nonexistent(full_list):
    assert full_list.search(18) is None


def test_remove(full_list):
    node = full_list.search(5)
    full_list.remove(node)
    assert full_list.search(5) is None
    assert full_list.head.next.value == 'a string'
    assert full_list.size == 3


def test_remove_last(full_list):
    node = full_list.search(True)
    full_list.remove(node)
    assert full_list.search(True) is None
    node2 = full_list.search('a string')
    assert node2.next is None
    assert full_list.size == 3


def test_remove_nonexistent(full_list):
    with pytest.raises(ValueError):
        full_list.remove(Node(17))


def test_remove_bad_type(full_list):
    with pytest.raises(ValueError):
        full_list.remove(5)


def test_display(full_list):
    assert full_list.display() == (10, 5, 'a string', True)


def test_display_empty_list():
    list = LinkedList()
    assert list.display() == ()


def test_string(full_list):
    assert str(full_list) == "(10, 5, u'a string', True)"<commit_msg>tested a higher unicode character<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals

from linked_list import LinkedList, Node
import pytest


@pytest.fixture
def full_list():
    list = LinkedList()
    list.insert(True)
    list.insert('a string')
    list.insert(5)
    list.insert(10)
    return list


def test_node_init():
    node = Node(5)
    assert node.value == 5
    assert node.next is None


def test_node_bad_init():
    with pytest.raises(TypeError):
        node = Node(24, 'blah', 'blah')


def test_empty_list():
    list = LinkedList()
    assert isinstance(list, LinkedList)
    assert list.head is None


def test_insert():
    list = LinkedList()
    list.insert(5)
    assert list.head.value == 5


def test_size(full_list):
    assert full_list.size == 4


def test_list_init_iterable():
    list = LinkedList([5, True, 'string'])
    assert list.head.value == 'string'
    assert list.size == 3
    assert list.search(True).value is True


def test_list_init_not_iterable():
    with pytest.raises(TypeError):
        list = LinkedList(534)


def test_pop(full_list):
    assert full_list.pop() == 10
    assert full_list.size == 3


def test_pop_empty_list():
    list = LinkedList()
    with pytest.raises(IndexError):
        list.pop()


def test_search(full_list):
    assert full_list.search(5).value == 5


def test_search_nonexistent(full_list):
    assert full_list.search(18) is None


def test_remove(full_list):
    node = full_list.search(5)
    full_list.remove(node)
    assert full_list.search(5) is None
    assert full_list.head.next.value == 'a string'
    assert full_list.size == 3


def test_remove_last(full_list):
    node = full_list.search(True)
    full_list.remove(node)
    assert full_list.search(True) is None
    node2 = full_list.search('a string')
    assert node2.next is None
    assert full_list.size == 3


def test_remove_nonexistent(full_list):
    with pytest.raises(ValueError):
        full_list.remove(Node(17))


def test_remove_bad_type(full_list):
    with pytest.raises(ValueError):
        full_list.remove(5)


def test_display(full_list):
    assert full_list.display() == (10, 5, 'a string', True)


def test_display_empty_list():
    list = LinkedList()
    assert list.display() == ()


def test_string(full_list):
    assert str(full_list) == "(10, 5, u'a string', True)"


def test_unicode():
    list = LinkedList(['a ɶ character'])
    assert list.display() == ('a ɶ character',)
{'fraction_non_alphanumeric': 0.11801114091190427, 'fraction_numerical': 0.015679801939343926, 'mean_word_length': 3.509767441860465, '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': '1833687', 'n_tokens_mistral': 1713, 'n_tokens_neox': 1642, 'n_words': 386}