<commit_before>import pytest
import npc
import os
from tests.util import fixture_dir

def test_creation(prefs):
    assert prefs is not None

def test_override(prefs):
    override_path = fixture_dir('settings/settings-vim.json')
    old_editor = prefs.get('editor')
    prefs.load_more(override_path)
    assert prefs.get('editor') != old_editor

def test_nested_get(prefs):
    assert prefs.get('paths.characters') == 'Characters'

def test_get_settings_path(prefs):
    assert prefs.get_settings_path('default') == os.path.join(prefs.default_settings_path, 'settings-default.json')
    assert prefs.get_settings_path('campaign') == os.path.join(prefs.campaign_settings_path, 'settings.json')

@pytest.mark.parametrize('settings_type', ['changeling', 'werewolf'])
def test_get_typed_settings_path(prefs, settings_type):
    fetched_path = prefs.get_settings_path('default', settings_type)
    assert fetched_path == os.path.join(prefs.default_settings_path, 'settings-{}.json'.format(settings_type))

def test_support_paths(prefs):
    """Paths loaded from additional files should be expanded relative to that file"""
    override_path = fixture_dir('settings/settings-paths.json')
    prefs.load_more(override_path)
    assert prefs.get('support.testpath') == fixture_dir('settings/nothing.json')<commit_msg>Fix fixture_dir usage<commit_after>import pytest
import npc
import os
from tests.util import fixture_dir

def test_creation(prefs):
    assert prefs is not None

def test_override(prefs):
    override_path = fixture_dir('settings', 'settings-vim.json')
    old_editor = prefs.get('editor')
    prefs.load_more(override_path)
    assert prefs.get('editor') != old_editor

def test_nested_get(prefs):
    assert prefs.get('paths.characters') == 'Characters'

def test_get_settings_path(prefs):
    assert prefs.get_settings_path('default') == os.path.join(prefs.default_settings_path, 'settings-default.json')
    assert prefs.get_settings_path('campaign') == os.path.join(prefs.campaign_settings_path, 'settings.json')

@pytest.mark.parametrize('settings_type', ['changeling', 'werewolf'])
def test_get_typed_settings_path(prefs, settings_type):
    fetched_path = prefs.get_settings_path('default', settings_type)
    assert fetched_path == os.path.join(prefs.default_settings_path, 'settings-{}.json'.format(settings_type))

def test_support_paths(prefs):
    """Paths loaded from additional files should be expanded relative to that file"""
    override_path = fixture_dir('settings', 'settings-paths.json')
    prefs.load_more(override_path)
    assert prefs.get('support.testpath') == fixture_dir('settings', 'nothing.json')
{'fraction_non_alphanumeric': 0.12353164077302008, 'fraction_numerical': 0.0, 'mean_word_length': 6.154471544715447, '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': '884690', 'n_tokens_mistral': 852, 'n_tokens_neox': 843, 'n_words': 154}