# This code has been automatically generated by:
# dev_scripts/test_codegen/generate_test_for_x_or_default.py
# Do NOT edit or append.


"""Test ``X_or_default`` methods on classes which contain lists."""


# pylint: disable=missing-docstring


import unittest

import tests.common
import tests.common_jsonization


class Test_Extension(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.Extension`.
    """

    def test_value_type_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_extension()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Extension"
            / "on_maximal.json"
            / "value_type_or_default.trace"
        )

        log = [tests.common.trace(instance.value_type_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_value_type_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_extension()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Extension"
            / "on_minimal.json"
            / "value_type_or_default.trace"
        )

        log = [tests.common.trace(instance.value_type_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_Qualifier(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.Qualifier`.
    """

    def test_kind_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_qualifier()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Qualifier"
            / "on_maximal.json"
            / "kind_or_default.trace"
        )

        log = [tests.common.trace(instance.kind_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_kind_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_qualifier()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Qualifier"
            / "on_minimal.json"
            / "kind_or_default.trace"
        )

        log = [tests.common.trace(instance.kind_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_Submodel(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.Submodel`.
    """

    def test_kind_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_submodel()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Submodel"
            / "on_maximal.json"
            / "kind_or_default.trace"
        )

        log = [tests.common.trace(instance.kind_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_kind_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_submodel()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Submodel"
            / "on_minimal.json"
            / "kind_or_default.trace"
        )

        log = [tests.common.trace(instance.kind_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_SubmodelElementList(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.SubmodelElementList`.
    """

    def test_order_relevant_or_default_on_maximal_instance_against_recorded(
        self,
    ) -> None:
        instance = tests.common_jsonization.load_maximal_submodel_element_list()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "SubmodelElementList"
            / "on_maximal.json"
            / "order_relevant_or_default.trace"
        )

        log = [tests.common.trace(instance.order_relevant_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_order_relevant_or_default_on_minimal_instance_against_recorded(
        self,
    ) -> None:
        instance = tests.common_jsonization.load_minimal_submodel_element_list()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "SubmodelElementList"
            / "on_minimal.json"
            / "order_relevant_or_default.trace"
        )

        log = [tests.common.trace(instance.order_relevant_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_Property(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.Property`.
    """

    def test_category_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_property()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Property"
            / "on_maximal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_category_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_property()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Property"
            / "on_minimal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_MultiLanguageProperty(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.MultiLanguageProperty`.
    """

    def test_category_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_multi_language_property()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "MultiLanguageProperty"
            / "on_maximal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_category_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_multi_language_property()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "MultiLanguageProperty"
            / "on_minimal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_Range(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.Range`.
    """

    def test_category_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_range()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Range"
            / "on_maximal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_category_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_range()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Range"
            / "on_minimal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_ReferenceElement(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.ReferenceElement`.
    """

    def test_category_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_reference_element()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "ReferenceElement"
            / "on_maximal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_category_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_reference_element()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "ReferenceElement"
            / "on_minimal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_Blob(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.Blob`.
    """

    def test_category_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_blob()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Blob"
            / "on_maximal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_category_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_blob()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "Blob"
            / "on_minimal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


class Test_File(unittest.TestCase):
    """
    Test ``X_or_default`` on instances of
    :py:class:`aas_core3.types.File`.
    """

    def test_category_or_default_on_maximal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_maximal_file()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "File"
            / "on_maximal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)

    def test_category_or_default_on_minimal_instance_against_recorded(self) -> None:
        instance = tests.common_jsonization.load_minimal_file()
        expected_path = (
            tests.common.TEST_DATA_DIR
            / "test_X_or_default"
            / "File"
            / "on_minimal.json"
            / "category_or_default.trace"
        )

        log = [tests.common.trace(instance.category_or_default())]
        got_text = tests.common.trace_log_as_text_file_content(log)
        tests.common.record_or_check(expected_path, got_text)


if __name__ == "__main__":
    unittest.main()


# This code has been automatically generated by:
# dev_scripts/test_codegen/generate_test_for_x_or_default.py
# Do NOT edit or append.
