<commit_before>#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import os
import sys

import pytest

sys.path.insert(0, "src")
import urn_nbn_api
from urn_nbn_api.xml_composer import compose_mono_xml
from urn_nbn_api.xml_composer import compose_mono_volume_xml


# Variables ===================================================================
# Functions & classes =========================================================
def data_context(fn):
    path = os.path.join(data_path(), fn)
    with open(path) as f:
        return f.read()


# Fixtures ====================================================================
@pytest.fixture
def data_path():
    wd = os.path.dirname(__file__)
    return os.path.join(wd, "data")


@pytest.fixture
def mono_mods_example():
    return data_context("mods_mono.xml")


@pytest.fixture
def mono_out_example():
    return data_context("mono_output.xml")


@pytest.fixture
def mono_vol_out_example():
    return data_context("mono_volume_output.xml")

<commit_msg>#4: data_path() is no longer fixture, moved to get_data_path().<commit_after>#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import os
import sys

import pytest

sys.path.insert(0, "src")
import urn_nbn_api
from urn_nbn_api.xml_composer import compose_mono_xml
from urn_nbn_api.xml_composer import compose_mono_volume_xml


# Variables ===================================================================
# Functions & classes =========================================================
def get_data_path():
    wd = os.path.dirname(__file__)
    return os.path.join(wd, "data")


def data_context(fn):
    path = os.path.join(get_data_path(), fn)
    with open(path) as f:
        return f.read()


# Fixtures ====================================================================
@pytest.fixture
def mono_mods_example():
    return data_context("mods_mono.xml")


@pytest.fixture
def mono_out_example():
    return data_context("mono_output.xml")


@pytest.fixture
def mono_vol_out_example():
    return data_context("mono_volume_output.xml")


{'fraction_non_alphanumeric': 0.3201407211961302, 'fraction_numerical': 0.00395778364116095, 'mean_word_length': 5.978527607361963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '1850048', 'n_tokens_mistral': 717, 'n_tokens_neox': 670, 'n_words': 139}