예제 #1
0
    def test_replace_placeholders_empty_string(self):
        """
        Should do nothing.
        """
        expected_string = ""

        actual_string = Placeholder.replace_placeholders(expected_string)

        self.assertEqual(expected_string, actual_string)
예제 #2
0
    def test_replace_placeholders_no_placeholder(self):
        """
        Should do nothing.
        """
        expected_string = "This is a string with nothing"

        actual_string = Placeholder.replace_placeholders(expected_string)

        self.assertEqual(expected_string, actual_string)
예제 #3
0
    def test_replace_placeholders_unkwon_placeholder(self):
        """
        Should do nothing.
        """
        expected_string = f"This is a string with " \
                          f"{Placeholder.PLACEHOLDER_START}unkown{Placeholder.PLACEHOLDER_END}"

        actual_string = Placeholder.replace_placeholders(expected_string)

        self.assertEqual(expected_string, actual_string)
예제 #4
0
    def test_replace_placeholders(self):
        """
        Should replace the placeholder inside the provided text, if the value for the placeholder has already been
        defined.
        """
        string_with_placeholder = f"This is a string with " \
                                  f"{Placeholder.PLACEHOLDER_START}placeholder{Placeholder.PLACEHOLDER_END}"
        placeholder_value = "Yabubabba!"
        Placeholder._instruction_placeholders["placeholder"] = placeholder_value
        expected_string = f"This is a string with {placeholder_value}"

        actual_string = Placeholder.replace_placeholders(string_with_placeholder)

        self.assertEqual(expected_string, actual_string)
예제 #5
0
 def cache_parameters(cls, attributes: UserDict = None) -> None:
     for attributename in attributes.keys():
         attributevalue = Placeholder.replace_placeholders(attributes[attributename])
         Placeholder.update_placeholder(attributename, attributevalue)
         SourceBase._logger.debug(
             f"Source: Cached source parameter '{attributename}'. Parameter value: '{attributevalue}'")
예제 #6
0
"""