From 3151741d6bc4ef90c321125253181d620bd583ba Mon Sep 17 00:00:00 2001 From: Matthew Mizielinski Date: Tue, 21 Jan 2025 17:16:17 +0000 Subject: [PATCH] Issue #22: Updates to import statements to ensure all tests work --- data_request_api/dev/JA/workflow_example_GRtest.py | 4 ++-- .../stable/content/dreq_api/consolidate_export.py | 4 ++-- data_request_api/stable/content/dreq_api/dreq_content.py | 4 ++-- data_request_api/stable/content/dump_transformation.py | 4 ++-- data_request_api/stable/query/data_request.py | 8 ++++---- data_request_api/stable/query/vocabulary_server.py | 4 ++-- data_request_api/stable/utilities/tools.py | 2 +- scripts/database_transformation.py | 6 +++--- scripts/workflow_example_2.py | 4 ++-- tests/test_data_request.py | 6 +++--- tests/test_dump_transformation.py | 4 ++-- tests/test_vocabulary_server.py | 9 ++------- tests/test_workflow.py | 7 ++----- 13 files changed, 29 insertions(+), 37 deletions(-) diff --git a/data_request_api/dev/JA/workflow_example_GRtest.py b/data_request_api/dev/JA/workflow_example_GRtest.py index aded258..31301e2 100644 --- a/data_request_api/dev/JA/workflow_example_GRtest.py +++ b/data_request_api/dev/JA/workflow_example_GRtest.py @@ -14,8 +14,8 @@ import json from data_request_api.stable.content.dreq_api import dreq_content as dc -from data_request_api.stable.transform.data_request import DataRequest -from data_request_api.stable.transform.logger import change_log_file, change_log_level +from data_request_api.stable.query.data_request import DataRequest +from data_request_api.stable.utilities.logger import change_log_file, change_log_level # Set up log file (default to stdout) and log level change_log_file(default=True) diff --git a/data_request_api/stable/content/dreq_api/consolidate_export.py b/data_request_api/stable/content/dreq_api/consolidate_export.py index e123b27..f83298d 100644 --- a/data_request_api/stable/content/dreq_api/consolidate_export.py +++ b/data_request_api/stable/content/dreq_api/consolidate_export.py @@ -3,8 +3,8 @@ import re import warnings -from ...transform.logger import get_logger # noqa -from .mapping_table import version_consistency +from data_request_api.stable.utilities.logger import get_logger # noqa +from data_request_api.stable.content.dreq_api.mapping_table import version_consistency # UID generation default_count = 0 diff --git a/data_request_api/stable/content/dreq_api/dreq_content.py b/data_request_api/stable/content/dreq_api/dreq_content.py index 2b2fae3..fc892c0 100644 --- a/data_request_api/stable/content/dreq_api/dreq_content.py +++ b/data_request_api/stable/content/dreq_api/dreq_content.py @@ -11,8 +11,8 @@ from bs4 import BeautifulSoup from . import consolidate_export as ce -from .mapping_table import mapping_table -from ...transform.logger import get_logger # noqa +from data_request_api.stable.content.dreq_api.mapping_table import mapping_table +from data_request_api.stable.utilities.logger import get_logger # noqa # Suppress pooch info output diff --git a/data_request_api/stable/content/dump_transformation.py b/data_request_api/stable/content/dump_transformation.py index 09866f1..5878af1 100644 --- a/data_request_api/stable/content/dump_transformation.py +++ b/data_request_api/stable/content/dump_transformation.py @@ -16,8 +16,8 @@ import six -from utilities.logger import get_logger, change_log_level, change_log_file -from utilities.tools import read_json_input_file_content, write_json_output_file_content +from data_request_api.stable.utilities.logger import get_logger, change_log_level, change_log_file +from data_request_api.stable.utilities.tools import read_json_input_file_content, write_json_output_file_content def correct_key_string(input_string, *to_remove_strings): diff --git a/data_request_api/stable/query/data_request.py b/data_request_api/stable/query/data_request.py index 96f9b0c..0df5df1 100644 --- a/data_request_api/stable/query/data_request.py +++ b/data_request_api/stable/query/data_request.py @@ -14,10 +14,10 @@ import six -from utilities.logger import get_logger, change_log_file, change_log_level -from content.dump_transformation import transform_content -from utilities.tools import read_json_file -from query.vocabulary_server import VocabularyServer, is_link_id_or_value, build_link_from_id +from data_request_api.stable.utilities.logger import get_logger, change_log_file, change_log_level +from data_request_api.stable.content.dump_transformation import transform_content +from data_request_api.stable.utilities.tools import read_json_file +from data_request_api.stable.query.vocabulary_server import VocabularyServer, is_link_id_or_value, build_link_from_id version = "0.1" diff --git a/data_request_api/stable/query/vocabulary_server.py b/data_request_api/stable/query/vocabulary_server.py index c221134..7c4f41c 100644 --- a/data_request_api/stable/query/vocabulary_server.py +++ b/data_request_api/stable/query/vocabulary_server.py @@ -12,8 +12,8 @@ import six -from utilities.logger import get_logger -from utilities.tools import read_json_file +from data_request_api.stable.utilities.logger import get_logger +from data_request_api.stable.utilities.tools import read_json_file def is_link_id_or_value(elt): diff --git a/data_request_api/stable/utilities/tools.py b/data_request_api/stable/utilities/tools.py index d09a86a..78b08d2 100644 --- a/data_request_api/stable/utilities/tools.py +++ b/data_request_api/stable/utilities/tools.py @@ -9,7 +9,7 @@ import json import os -from utilities.logger import get_logger +from data_request_api.stable.utilities.logger import get_logger def read_json_file(filename): diff --git a/scripts/database_transformation.py b/scripts/database_transformation.py index 0d1e96c..b4c1677 100644 --- a/scripts/database_transformation.py +++ b/scripts/database_transformation.py @@ -10,9 +10,9 @@ import sys import data_request_api.stable.content.dreq_api.dreq_content as dc -from data_request_api.stable.transform.dump_transformation import transform_content -from data_request_api.stable.transform.tools import write_json_output_file_content -from data_request_api.stable.transform.logger import change_log_file, change_log_level +from data_request_api.stable.content.dump_transformation import transform_content +from data_request_api.stable.utilities.tools import write_json_output_file_content +from data_request_api.stable.utilities.logger import change_log_file, change_log_level # Set up log file (default to stdout) and log level diff --git a/scripts/workflow_example_2.py b/scripts/workflow_example_2.py index be597d0..da28b8c 100644 --- a/scripts/workflow_example_2.py +++ b/scripts/workflow_example_2.py @@ -28,8 +28,8 @@ import six from data_request_api.stable.content import dreq_content as dc -from data_request_api.stable.transform.data_request import DataRequest -from data_request_api.stable.transform.logger import change_log_file, change_log_level +from data_request_api.stable.query.data_request import DataRequest +from data_request_api.stable.utilities.logger import change_log_file, change_log_level # Set up log file (default to stdout) and log level diff --git a/tests/test_data_request.py b/tests/test_data_request.py index a0b0e28..7d85c66 100644 --- a/tests/test_data_request.py +++ b/tests/test_data_request.py @@ -10,10 +10,10 @@ import os import unittest -from data_request_api.stable.transform.tools import read_json_input_file_content, write_json_output_file_content +from data_request_api.stable.utilities.tools import read_json_input_file_content, write_json_output_file_content -from data_request_api.stable.transform.data_request import DRObjects, Theme, ExperimentsGroup, VariablesGroup, Opportunity, DataRequest, version -from data_request_api.stable.transform.vocabulary_server import VocabularyServer, is_link_id_or_value +from data_request_api.stable.query.data_request import DRObjects, ExperimentsGroup, VariablesGroup, Opportunity, DataRequest, version +from data_request_api.stable.query.vocabulary_server import VocabularyServer, is_link_id_or_value class TestDRObjects(unittest.TestCase): diff --git a/tests/test_dump_transformation.py b/tests/test_dump_transformation.py index 7ba3480..ba1783b 100644 --- a/tests/test_dump_transformation.py +++ b/tests/test_dump_transformation.py @@ -9,8 +9,8 @@ import copy import unittest -from data_request_api.stable.transform.tools import read_json_file, write_json_output_file_content -from data_request_api.stable.transform.dump_transformation import correct_key_string, correct_dictionaries, transform_content_one_base,\ +from data_request_api.stable.utilities.tools import read_json_file, write_json_output_file_content +from data_request_api.stable.content.dump_transformation import correct_key_string, correct_dictionaries, transform_content_one_base,\ transform_content_three_bases, transform_content, split_content_one_base diff --git a/tests/test_vocabulary_server.py b/tests/test_vocabulary_server.py index 1f2c242..b193a51 100644 --- a/tests/test_vocabulary_server.py +++ b/tests/test_vocabulary_server.py @@ -8,14 +8,9 @@ import copy import unittest -import sys - -sys.path.append('../data_request_api/stable') - - -from utilities.tools import read_json_input_file_content -from query.vocabulary_server import VocabularyServer, is_link_id_or_value, build_link_from_id +from data_request_api.stable.utilities.tools import read_json_input_file_content +from data_request_api.stable.query.vocabulary_server import VocabularyServer, is_link_id_or_value, build_link_from_id class TestLinks(unittest.TestCase): diff --git a/tests/test_workflow.py b/tests/test_workflow.py index aaf44a8..cbfed2d 100644 --- a/tests/test_workflow.py +++ b/tests/test_workflow.py @@ -11,12 +11,9 @@ import unittest import tempfile -sys.path.append('../data_request_api/stable') -sys.path.append("../data_request_api/stable/content/dreq_api") - -import dreq_content as dc -from query.data_request import DataRequest +import data_request_api.stable.content.dreq_api.dreq_content as dc +from data_request_api.stable.query.data_request import DataRequest class TestWorkflow1(unittest.TestCase):