# 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: pyxform/xls2json.py
# class SurveyReader(SpreadsheetReader):
#     """
#     SurveyReader is a wrapper for the parse_file_to_json function.
#     It allows us to use the old interface where a SpreadsheetReader
#     based object is created then a to_json_dict function is called on it.
#     """
# 
#     def __init__(self, path_or_file, default_name=None):
#         if isinstance(path_or_file, str):
#             self._file_object = None
#             path = path_or_file
#         else:
#             self._file_object = path_or_file
#             path = path_or_file.name
# 
#         self._warnings = []
#         self._dict = parse_file_to_json(
#             path,
#             default_name=default_name,
#             warnings=self._warnings,
#             file_object=self._file_object,
#         )
#         self._path = path
# 
#     def print_warning_log(self, warn_out_file):
#         # Open file to print warning log to.
#         warn_out = open(warn_out_file, "w")
#         warn_out.write("\n".join(self._warnings))
# 
# 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():


from unittest import TestCase
from pyxform.builder import create_survey_from_path
from pyxform.xls2json import SurveyReader
from tests import utils
# -*- coding: utf-8 -*-
"""
Test settings sheet syntax.
"""




class SettingsTests(TestCase):

    maxDiff = None

    def setUp(self):
        self.path = utils.path_to_text_fixture("settings.xls")

    def test_survey_reader(self):

# 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: pyxform/xls2json.py
# class SurveyReader(SpreadsheetReader):
#     """
#     SurveyReader is a wrapper for the parse_file_to_json function.
#     It allows us to use the old interface where a SpreadsheetReader
#     based object is created then a to_json_dict function is called on it.
#     """
# 
#     def __init__(self, path_or_file, default_name=None):
#         if isinstance(path_or_file, str):
#             self._file_object = None
#             path = path_or_file
#         else:
#             self._file_object = path_or_file
#             path = path_or_file.name
# 
#         self._warnings = []
#         self._dict = parse_file_to_json(
#             path,
#             default_name=default_name,
#             warnings=self._warnings,
#             file_object=self._file_object,
#         )
#         self._path = path
# 
#     def print_warning_log(self, warn_out_file):
#         # Open file to print warning log to.
#         warn_out = open(warn_out_file, "w")
#         warn_out.write("\n".join(self._warnings))
# 
# 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/settings_test.py
from unittest import TestCase
from pyxform.builder import create_survey_from_path
from pyxform.xls2json import SurveyReader
from tests import utils

# -*- coding: utf-8 -*-
"""
Test settings sheet syntax.
"""




class SettingsTests(TestCase):

    maxDiff = None

    def setUp(self):
        self.path = utils.path_to_text_fixture("settings.xls")

    def test_survey_reader(self):

        survey_reader = SurveyReader(self.path, default_name="settings")