<commit_before>import pytest
from py2neo import Graph, Node, Relationship
from pytest_flask.plugin import client

from family_tree import fwalk
from api import conf

@pytest.fixture
def graph(request):
    ''' a fixture to add a simple family tree graph
                    +-----------------+
                    |great grandfather|
                    +-----------------+
                    FATHER_OF|
                        +-----v-----+               +-----------+
                        |grandfather+-----spouse----+grandmother|
                        +-----+-----+               +-----+-----+
                              +----------+        +-------+
                                FATHER_OF|        |MOTHER_OF
                            +-----------++--------+-----+
                            |           |               |
        +------+        +-----v+       +--v--+         +--v-+
        |father+---S----+mother|       |uncle|         |aunt|
        +--+---+        +---+--+       +-----+         +----+
           +-----+    +-----+
        FATHER_OF|    |MOTHER_OF
        +-------------+-----------+
        |             |           |
    +---v----+   +----v---+    +--v---+
    |brother1|   |brother2|    |sister|
    +--------+   +--------+    +------+

    '''
    def fin():
        g.cypher.execute("MATCH (n { tree_id: '1' }) optional match (n)-[r]-() delete n,r")
    request.addfinalizer(fin)

    g = Graph(conf.neo4j_url)
    nodes = [
        Node("INDI", tree_id='1', id='1', NAME="grandfather's father", SEX='M'),
        Node("INDI", tree_id='1', id='2', NAME="grandfather", SEX='M'),
        Node("INDI", tree_id='1', id='3', NAME="grandmother", SEX='F'),
        Node("INDI", tree_id='1', id='4', NAME="mother", SEX='F', birth_year=1940),
        Node("INDI", tree_id='1', id='5', NAME="father", SEX='M'),
        Node("INDI", tree_id='1', id='6', NAME="uncle", SEX='M'),
        Node("INDI", tree_id='1', id='7', NAME="aunt", SEX='F'),
        Node("INDI", tree_id='1', id='8', NAME="brother1", SEX='M'),
        Node("INDI", tree_id='1', id='9', NAME="brother2", SEX='M'),
        Node("INDI", tree_id='1', id='10', NAME="sister", SEX='F'),
        Node("INDI", tree_id='1', id='11', SEX='F'),<commit_msg>use a neo4j test server<commit_after>import pytest
from py2neo import Graph, Node, Relationship
from pytest_flask.plugin import client

from family_tree import fwalk

@pytest.fixture
def graph(request):
    ''' a fixture to add a simple family tree graph
                    +-----------------+
                    |great grandfather|
                    +-----------------+
                    FATHER_OF|
                        +-----v-----+               +-----------+
                        |grandfather+-----spouse----+grandmother|
                        +-----+-----+               +-----+-----+
                              +----------+        +-------+
                                FATHER_OF|        |MOTHER_OF
                            +-----------++--------+-----+
                            |           |               |
        +------+        +-----v+       +--v--+         +--v-+
        |father+---S----+mother|       |uncle|         |aunt|
        +--+---+        +---+--+       +-----+         +----+
           +-----+    +-----+
        FATHER_OF|    |MOTHER_OF
        +-------------+-----------+
        |             |           |
    +---v----+   +----v---+    +--v---+
    |brother1|   |brother2|    |sister|
    +--------+   +--------+    +------+

    '''
    def fin():
        g.cypher.execute("MATCH (n { tree_id: '1' }) optional match (n)-[r]-() delete n,r")
    request.addfinalizer(fin)

    g = Graph("http://neo4j:bhonline@172.16.31.10:7474/db/data")
    nodes = [
        Node("INDI", tree_id='1', id='1', NAME="grandfather's father", SEX='M'),
        Node("INDI", tree_id='1', id='2', NAME="grandfather", SEX='M'),
        Node("INDI", tree_id='1', id='3', NAME="grandmother", SEX='F'),
        Node("INDI", tree_id='1', id='4', NAME="mother", SEX='F', birth_year=1940),
        Node("INDI", tree_id='1', id='5', NAME="father", SEX='M'),
        Node("INDI", tree_id='1', id='6', NAME="uncle", SEX='M'),
        Node("INDI", tree_id='1', id='7', NAME="aunt", SEX='F'),
        Node("INDI", tree_id='1', id='8', NAME="brother1", SEX='M'),
        Node("INDI", tree_id='1', id='9', NAME="brother2", SEX='M'),
        Node("INDI", tree_id='1', id='10', NAME="sister", SEX='F'),
        Node("INDI", tree_id='1', id='11', SEX='F'),
{'fraction_non_alphanumeric': 0.2750995134896064, 'fraction_numerical': 0.018575851393188854, 'mean_word_length': 1.1734742912061509, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4375696', 'n_tokens_mistral': 1492, 'n_tokens_neox': 1402, 'n_words': 247}