Exemple #1
0
class TestUnimplementedMethodException(unittest.TestCase):
    def setUp(self):
        self.e = UnimplementedMethodException("ClassName", "MethodName")

    def test_type(self):
        self.assertTrue(isinstance(self.e, Exception))

    def test_return_type(self):
        self.assertTrue(isinstance(self.e.__str__(), str))
Exemple #2
0
    def get_names_of_dependent_objects(self):
        """
        This method should be overridden in derived classes and return a list of object names that the derived
        transition implementation is dependent upon.

        :return: A list of string object names
        :raises UnimplementedMethodException: Raised if this method is called on the base class itself
        """
        raise UnimplementedMethodException("TransitionRule",
                                           "get_names_of_dependent_objects")
Exemple #3
0
    def get_name_of_object_to_transition(self):
        """
        This method should be overridden in derived classes and return a single name of an object that this rule handles
        the transition for.

        :return: A string name of an object to transition
        :raises UnimplementedMethodException: Raised if this method is called on the base class itself
        """
        raise UnimplementedMethodException("TransitionRule",
                                           "get_name_of_object_to_transition")
Exemple #4
0
    def get_complex_operation_types(self):
        """
        This method should be overridden in the derived classes and return a list of object names that require more
        complex transition operations than a simple variable name swap

        :return: A list of strings, each representing an object name that requires complex transition operations
        :raises UnimplementedMethodException: Raised if this method is called on the base class itself
        """
        raise UnimplementedMethodException("OutputVariableTransitionRule",
                                           "get_complex_operation_types")
Exemple #5
0
    def get_simple_swaps(self):
        """
        This method should be overridden in derived classes and return a dictionary where each key is the name of
        an output variable, and the value of each key is the new variable name.  This map is used when doing the
        simple variable name swaps.

        :return: A dictionary of <old_variable_name, new_variable_name>
        :raises UnimplementedMethodException: Raised if this method is called on the base class itself
        """
        raise UnimplementedMethodException("OutputVariableTransitionRule",
                                           "get_simple_swaps")
Exemple #6
0
    def get_output_objects(self):
        """
        This method should be overridden in derived classes and return a list of all output-related object types
        in this version of EnergyPlus.  A base version is available in the base class that can be used as a starter
        and if an object name changes, the derived class can change that name as needed in the return array.

        :return: A list of strings, each representing an output object type name
        :raises UnimplementedMethodException: Raised if this method is called on the base class itself
        """
        raise UnimplementedMethodException("OutputVariableTransitionRule",
                                           "get_output_objects")
Exemple #7
0
    def transition(self, core_object, dependent_objects):
        """
        This method is the core transition operation for this object.

        :param core_object: The original idf object to be transitioned
        :param dependent_objects: A dictionary of {object_name: [idf_object, ...]} containing the idf object data in the
                                  original idf that have object names defined in this derived classes
                                  `get_names_of_dependent_objects` method.  Each key in this argument is a string
                                  object name, and each value is a list of all the idf objects in the file of that type.
        :return: A list of new IDFObject instances, typically just one though
        :raises UnimplementedMethodException: Raised if this method is called on the base class itself
        """
        raise UnimplementedMethodException("TransitionRule", "transition")
Exemple #8
0
    def complex_output_operation(self, full_object, dependent_objects):
        """
        This method should be overridden in derived classes and should perform the complex operations to transition
        the argument object passed in.  The function should return a list because some complex operations may split the
        initial object into multiple objects.  The object passed in will have any simple name swaps already performed.

        :param full_object: The original object to be replaced.
        :param dependent_objects: A dictionary of dependent objects
        :return: A list of new IDFObject instances, typically just one though
        :raises UnimplementedMethodException: Raised if this method is called on the base class itself
        """
        raise UnimplementedMethodException("OutputVariableTransitionRule",
                                           "complex_output_operation")
Exemple #9
0
    def get_standard_indexes_from_object(self, object_name):
        """
        This method should be overridden in derived classes and return a list of the zero-based field indexes that
        include a variable name in the given object type.  A base version is available in the base class that can be
        used as a starter and if the structure of any object types changes, the derived class can change that one as
        needed in the return list

        :param object_name: The name of the object being inspected
        :return: A list of zero-based indexes, each representing a field containing an output variable name
        :raises UnimplementedMethodException: Raised if this method is called on the base class itself
        """
        raise UnimplementedMethodException("OutputVariableTransitionRule",
                                           "get_standard_indexes_from_object")
Exemple #10
0
 def setUp(self):
     self.e = UnimplementedMethodException("ClassName", "MethodName")