# Path: pyxform/builder.py
# def create_survey_element_from_dict(self, d):
#     """
#     Convert from a nested python dictionary/array structure (a json dict I
#     call it because it corresponds directly with a json object)
#     to a survey object
#     """
#     if "add_none_option" in d:
#         self._add_none_option = d["add_none_option"]
#     if d["type"] in self.SECTION_CLASSES:
#         section = self._create_section_from_dict(d)
# 
#         if d["type"] == "survey":
#             section.setvalues_by_triggering_ref = self.setvalues_by_triggering_ref
# 
#         return section
#     elif d["type"] == "loop":
#         return self._create_loop_from_dict(d)
#     elif d["type"] == "include":
#         section_name = d["name"]
#         if section_name not in self._sections:
#             raise PyXFormError(
#                 "This section has not been included.",
#                 section_name,
#                 self._sections.keys(),
#             )
#         d = self._sections[section_name]
#         full_survey = self.create_survey_element_from_dict(d)
#         return full_survey.children
#     elif d["type"] in ["xml-external", "csv-external"]:
#         return ExternalInstance(**d)
#     else:
#         self._save_trigger_as_setvalue_and_remove_calculate(d)
# 
#         return self._create_question_from_dict(
#             d, copy_json_dict(QUESTION_TYPE_DICT), self._add_none_option
#         )
# 
# 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_element_from_dict
from pyxform.xls2json import SurveyReader
from tests import utils
                        {
                            "name": "phone_number",
                            "type": "phone number",
                            "label": {"English": "What's your father's phone number?"},
                        },
                        {
                            "name": "age",
                            "type": "integer",
                            "label": {"English": "How old is your father?"},
                        },
                    ],
                },
                {
                    "children": [
                        {
                            "bind": {"jr:preload": "uid", "readonly": "true()"},
                            "name": "instanceID",
                            "type": "calculate",
                        }
                    ],
                    "control": {"bodyless": True},
                    "name": "meta",
                    "type": "group",
                },
            ],
        }
        self.maxDiff = None
        self.assertEqual(x_results, expected_dict)

    def test_equality_of_to_dict(self):

# Path: pyxform/builder.py
# def create_survey_element_from_dict(self, d):
#     """
#     Convert from a nested python dictionary/array structure (a json dict I
#     call it because it corresponds directly with a json object)
#     to a survey object
#     """
#     if "add_none_option" in d:
#         self._add_none_option = d["add_none_option"]
#     if d["type"] in self.SECTION_CLASSES:
#         section = self._create_section_from_dict(d)
# 
#         if d["type"] == "survey":
#             section.setvalues_by_triggering_ref = self.setvalues_by_triggering_ref
# 
#         return section
#     elif d["type"] == "loop":
#         return self._create_loop_from_dict(d)
#     elif d["type"] == "include":
#         section_name = d["name"]
#         if section_name not in self._sections:
#             raise PyXFormError(
#                 "This section has not been included.",
#                 section_name,
#                 self._sections.keys(),
#             )
#         d = self._sections[section_name]
#         full_survey = self.create_survey_element_from_dict(d)
#         return full_survey.children
#     elif d["type"] in ["xml-external", "csv-external"]:
#         return ExternalInstance(**d)
#     else:
#         self._save_trigger_as_setvalue_and_remove_calculate(d)
# 
#         return self._create_question_from_dict(
#             d, copy_json_dict(QUESTION_TYPE_DICT), self._add_none_option
#         )
# 
# 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/group_test.py
from unittest import TestCase
from pyxform.builder import create_survey_element_from_dict
from pyxform.xls2json import SurveyReader
from tests import utils

                        {
                            "name": "phone_number",
                            "type": "phone number",
                            "label": {"English": "What's your father's phone number?"},
                        },
                        {
                            "name": "age",
                            "type": "integer",
                            "label": {"English": "How old is your father?"},
                        },
                    ],
                },
                {
                    "children": [
                        {
                            "bind": {"jr:preload": "uid", "readonly": "true()"},
                            "name": "instanceID",
                            "type": "calculate",
                        }
                    ],
                    "control": {"bodyless": True},
                    "name": "meta",
                    "type": "group",
                },
            ],
        }
        self.maxDiff = None
        self.assertEqual(x_results, expected_dict)

    def test_equality_of_to_dict(self):

        x = SurveyReader(utils.path_to_text_fixture("group.xls"), default_name="group")