# Path: pyxform/builder.py
# def create_survey_from_path(path, include_directory=False):
#     """
#     include_directory -- Switch to indicate that all the survey forms in the
#                          same directory as the specified file should be read
#                          so they can be included through include types.
#     @see: create_survey
#     """
#     directory, file_name = os.path.split(path)
#     if include_directory:
#         main_section_name = file_utils._section_name(file_name)
#         sections = file_utils.collect_compatible_files_in_directory(directory)
#     else:
#         main_section_name, section = file_utils.load_file_to_dict(path)
#         sections = {main_section_name: section}
#     pkg = {"name_of_main_section": main_section_name, "sections": sections}
# 
#     return create_survey(**pkg)
# 
# Path: tests/utils.py
# def path_to_text_fixture(filename):
# def build_survey(filename):
# def create_survey_from_fixture(fixture_name, filetype="xls", include_directory=False):
# def prep_class_config(cls, test_dir="tests"):
# def prep_for_xml_contains(text: str) -> "Tuple[str]":
# def get_temp_file():
# def get_temp_dir():


import os
from unittest import TestCase
from pyxform.builder import create_survey_from_path
from tests import utils
"""



class DumpAndLoadTests(TestCase):
    def setUp(self):
        self.excel_files = [
            "gps.xls",
            # "include.xls",
            "specify_other.xls",
            "group.xls",
            "loop.xls",
            "text_and_integer.xls",
            # todo: this is looking for json that is created (and
            # deleted) by another test, is should just add that json
            # to the directory.
            # "include_json.xls",
            "simple_loop.xls",
            "yes_or_no_question.xls",
        ]
        self.surveys = {}
        self.this_directory = os.path.dirname(__file__)
        for filename in self.excel_files:
            path = utils.path_to_text_fixture(filename)
            self.surveys[filename] = create_survey_from_path(path)

    def test_load_from_dump(self):
        for filename, survey in self.surveys.items():
            survey.json_dump()
            path = survey.name + ".json"

# Path: pyxform/builder.py
# def create_survey_from_path(path, include_directory=False):
#     """
#     include_directory -- Switch to indicate that all the survey forms in the
#                          same directory as the specified file should be read
#                          so they can be included through include types.
#     @see: create_survey
#     """
#     directory, file_name = os.path.split(path)
#     if include_directory:
#         main_section_name = file_utils._section_name(file_name)
#         sections = file_utils.collect_compatible_files_in_directory(directory)
#     else:
#         main_section_name, section = file_utils.load_file_to_dict(path)
#         sections = {main_section_name: section}
#     pkg = {"name_of_main_section": main_section_name, "sections": sections}
# 
#     return create_survey(**pkg)
# 
# Path: tests/utils.py
# def path_to_text_fixture(filename):
# def build_survey(filename):
# def create_survey_from_fixture(fixture_name, filetype="xls", include_directory=False):
# def prep_class_config(cls, test_dir="tests"):
# def prep_for_xml_contains(text: str) -> "Tuple[str]":
# def get_temp_file():
# def get_temp_dir():


# Path: tests/dump_and_load_tests.py
import os
from unittest import TestCase
from pyxform.builder import create_survey_from_path
from tests import utils

"""



class DumpAndLoadTests(TestCase):
    def setUp(self):
        self.excel_files = [
            "gps.xls",
            # "include.xls",
            "specify_other.xls",
            "group.xls",
            "loop.xls",
            "text_and_integer.xls",
            # todo: this is looking for json that is created (and
            # deleted) by another test, is should just add that json
            # to the directory.
            # "include_json.xls",
            "simple_loop.xls",
            "yes_or_no_question.xls",
        ]
        self.surveys = {}
        self.this_directory = os.path.dirname(__file__)
        for filename in self.excel_files:
            path = utils.path_to_text_fixture(filename)
            self.surveys[filename] = create_survey_from_path(path)

    def test_load_from_dump(self):
        for filename, survey in self.surveys.items():
            survey.json_dump()
            path = survey.name + ".json"

            survey_from_dump = create_survey_from_path(path)