Beispiel #1
0
    def _insert_deprecation_warning(self):
        """
        If the algorithm version is deprecated then construct a warning message
        """
        from mantid.api import DeprecatedAlgorithmChecker

        checker = DeprecatedAlgorithmChecker(self.algorithm_name(),
                                             self.algorithm_version())
        msg = checker.isDeprecated()
        if len(msg) == 0:
            return

        # Check for message to use another algorithm an insert a link
        match = DEPRECATE_USE_ALG_RE.search(msg)
        if match is not None and len(match.groups()) == 4:
            link_text = match.group(1)
            alg_name = match.group(2)
            version = match.group(4)
            link = "algm-%s%s"
            if version is not None:
                link = link % (alg_name, "-v" + str(version))
            else:
                link = link % (alg_name, "")
            replacement = "Use :ref:`%s <%s>` instead." % (link_text, link)
            msg = DEPRECATE_USE_ALG_RE.sub(replacement, msg)
        # endif

        self.add_rst(".. warning:: %s" % msg)
Beispiel #2
0
    def _insert_deprecation_warning(self):
        """
        If the algorithm version is deprecated then construct a warning message
        """
        from mantid.api import DeprecatedAlgorithmChecker

        checker = DeprecatedAlgorithmChecker(self.algorithm_name(), self.algorithm_version())
        msg = checker.isDeprecated()
        if len(msg) == 0:
            return

        # Check for message to use another algorithm an insert a link
        match = DEPRECATE_USE_ALG_RE.search(msg)
        if match is not None and len(match.groups()) == 4:
            link_text = match.group(1)
            alg_name = match.group(2)
            version = match.group(4)
            link = "algm-%s%s"
            if version is not None:
                link = link % (alg_name, "-v" + str(version))
            else:
                link = link % (alg_name, "")
            replacement = "Use :ref:`%s <%s>` instead." % (link_text, link)
            msg = DEPRECATE_USE_ALG_RE.sub(replacement, msg)
        # endif

        self.add_rst(".. warning:: %s" % msg)
Beispiel #3
0
 def test_deprecated_algorithm_returns_non_empty_string_from_isDeprecated(
         self):
     deprecation_check = DeprecatedAlgorithmChecker("DiffractionFocussing",
                                                    1)
     msg = deprecation_check.isDeprecated()
     self.assertTrue(len(msg) > 0)
Beispiel #4
0
 def test_non_deprecated_algorithm_returns_empty_string_from_isDeprecated(
         self):
     deprecation_check = DeprecatedAlgorithmChecker("LoadRaw", -1)
     msg = deprecation_check.isDeprecated()
     self.assertTrue(len(msg) == 0)
 def test_non_deprecated_algorithm_returns_empty_string_from_isDeprecated(self):
     deprecation_check = DeprecatedAlgorithmChecker("LoadRaw",-1)
     msg = deprecation_check.isDeprecated()
     self.assertTrue(len(msg) == 0)
 def test_deprecated_algorithm_returns_non_empty_string_from_isDeprecated(self):
     deprecation_check = DeprecatedAlgorithmChecker("DiffractionFocussing",1)
     msg = deprecation_check.isDeprecated()
     self.assertTrue(len(msg) > 0)