<commit_before>import os.path

import arcpy
import pytest

import arcpyext

MXD_PATH = os.path.abspath("{0}/../samples/test_mapping.mxd".format(os.path.dirname(__file__)))
CLIP2_DATA_SOURCE = { "workspacePath": os.path.abspath("{0}/../samples/".format(os.path.dirname(__file__))), "datasetName": "statesp020_clip2" }
TEST_DATA_SOURCE = { "workspacePath": os.path.abspath("{0}/../samples/test_data_table2.gdb".format(os.path.dirname(__file__))) }

def pytest_funcarg__map():
    # print("MXD: " + MXD_PATH)
    return arcpy.mapping.MapDocument(MXD_PATH)

@pytest.mark.parametrize(("data_sources", "layer_data_sources_equal", "table_data_sources_equal", "raises_ex", "ex_type"), [
    ({'layers': [[ CLIP2_DATA_SOURCE ]], 'tableViews': [ TEST_DATA_SOURCE ]}, [False], [False], False, None),
    ({'layers': [[None]], 'tableViews': [None]}, [True], [True], False, None),
    ({'layers': [], 'tableViews': []}, [True], [True], True, arcpyext.exceptions.ChangeDataSourcesError)
])
def test_change_data_sources(map, data_sources, layer_data_sources_equal, table_data_sources_equal, raises_ex, ex_type):
    layers = arcpy.mapping.ListLayers(map)
    old_data_sources = []

    for layer in layers:
        old_data_sources.append(layer.dataSource)

    data_tables = arcpy.mapping.ListTableViews(map)
    old_table_sources = []

    for table in data_tables:
        # print table.name
        old_table_sources.append(table.dataSource)
<commit_msg>Fixed deprecated pytest funcarg<commit_after>import os.path

import arcpy
import pytest

import arcpyext

MXD_PATH = os.path.abspath("{0}/../samples/test_mapping.mxd".format(os.path.dirname(__file__)))
CLIP2_DATA_SOURCE = { "workspacePath": os.path.abspath("{0}/../samples/".format(os.path.dirname(__file__))), "datasetName": "statesp020_clip2" }
TEST_DATA_SOURCE = { "workspacePath": os.path.abspath("{0}/../samples/test_data_table2.gdb".format(os.path.dirname(__file__))) }

@pytest.fixture(scope="module")
def map():
    return arcpy.mapping.MapDocument(MXD_PATH)

@pytest.mark.parametrize(("data_sources", "layer_data_sources_equal", "table_data_sources_equal", "raises_ex", "ex_type"), [
    ({'layers': [[ CLIP2_DATA_SOURCE ]], 'tableViews': [ TEST_DATA_SOURCE ]}, [False], [False], False, None),
    ({'layers': [[None]], 'tableViews': [None]}, [True], [True], False, None),
    ({'layers': [], 'tableViews': []}, [True], [True], True, arcpyext.exceptions.ChangeDataSourcesError)
])
def test_change_data_sources(map, data_sources, layer_data_sources_equal, table_data_sources_equal, raises_ex, ex_type):
    layers = arcpy.mapping.ListLayers(map)
    old_data_sources = []

    for layer in layers:
        old_data_sources.append(layer.dataSource)

    data_tables = arcpy.mapping.ListTableViews(map)
    old_table_sources = []

    for table in data_tables:
        # print table.name
        old_table_sources.append(table.dataSource)

{'fraction_non_alphanumeric': 0.1634349030470914, 'fraction_numerical': 0.006925207756232687, 'mean_word_length': 5.4630872483221475, 'pattern_counts': {'":': 6, '<': 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': '6061463', 'n_tokens_mistral': 1019, 'n_tokens_neox': 1011, 'n_words': 154}