<commit_before># Copyright (c) 2015 <NAME>


from libtree import core, Node
from mock import patch


def test_basic_representation(trans, root):
    node = Node(trans, root.id)
    assert repr(node) == '<Node id={}>'.format(root.id, root.position)


def test_title_representation(trans, nd1):
    node = Node(trans, nd1.id)
    expected = "<Node id={}, title='Node 1'>".format(nd1.id)
    assert repr(node) == expected


def test_it_compares_other_nodes(trans, nd1, nd2):
    node1a = Node(trans, nd1.id)
    node1b = Node(trans, nd1.id)
    node2 = Node(trans, nd2.id)
    assert node1a == node1b
    assert node1a != node2


def test_it_wont_compared_other_types(trans, nd1, nd2):
    node = Node(trans, nd1.id)
    assert node != nd1


def test_get_parent(trans, nd2_1_1, nd2_leaf):
    node = Node(trans, nd2_leaf.id)
    parent = node.parent
    assert parent.id == nd2_1_1.id


def test_get_position(trans, nd3):
    node = Node(trans, nd3.id)<commit_msg>add test for Node.__hash__()<commit_after># Copyright (c) 2015 <NAME>


from libtree import core, Node
from mock import patch


def test_basic_representation(trans, root):
    node = Node(trans, root.id)
    assert repr(node) == '<Node id={}>'.format(root.id, root.position)


def test_title_representation(trans, nd1):
    node = Node(trans, nd1.id)
    expected = "<Node id={}, title='Node 1'>".format(nd1.id)
    assert repr(node) == expected


def test_it_compares_other_nodes(trans, nd1, nd2):
    node1a = Node(trans, nd1.id)
    node1b = Node(trans, nd1.id)
    node2 = Node(trans, nd2.id)
    assert node1a == node1b
    assert node1a != node2


def test_it_wont_compare_other_types(trans, nd1, nd2):
    node = Node(trans, nd1.id)
    assert node != nd1


def test_hash(trans, nd1, nd2):
    node1a = Node(trans, nd1.id)
    node1b = Node(trans, nd1.id)
    node2 = Node(trans, nd2.id)
    assert hash(node1a) == hash(node1b)
    assert hash(node1a) != hash(node2)


def test_get_parent(trans, nd2_1_1, nd2_leaf):
    node = Node(trans, nd2_leaf.id)
    parent = node.parent
    assert parent.id == nd2_1_1.id


def test_get_position(trans, nd3):
    node = Node(trans, nd3.id)
{'fraction_non_alphanumeric': 0.13274336283185842, 'fraction_numerical': 0.037261294829995344, 'mean_word_length': 3.8378378378378377, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3993332', 'n_tokens_mistral': 840, 'n_tokens_neox': 805, 'n_words': 193}