<commit_before># Copyright (c) 2015 <NAME>.
# Cura is released under the terms of the AGPLv3 or higher.

from UM.Application import Application #To use the plug-in manager.
from UM.PluginObject import PluginObject #To create artificial plug-ins.
from UM.VersionUpgrade import VersionUpgrade
from UM.VersionUpgradeManager import VersionUpgradeManager

import pytest

##  Tests the version upgrade manager.
class TestVersionUpgradeManager():
    ##  Executed before the first test function is executed.
    def setup_method(self, method):
        self._upgrade_manager = VersionUpgradeManager()

    ##  Executed after the last test function was executed.
    def teardown_method(self, method):
        pass

    ##  The individual test cases for shortest upgrade paths.
    #
    #   Each entry contains a list of possible upgrades. Each upgrade has a
    #   from_version, a to_version and a preference_type field. Each entry also
    #   has a destination version to upgrade to and a preference type to filter
    #   on. Each entry has a list of possible answers, each of which is a
    #   mapping of version numbers to indices referring to upgrades in the input
    #   list. Lastly, each entry has a name for debugging.
    test_shortest_paths_data = [
        ({
            "name": "two-step",
            "upgrades": [
                { "from_version": 0, "to_version": 1, "preference_type": "a" },
                { "from_version": 1, "to_version": 2, "preference_type": "a" }
            ],
            "destination": 2,
            "preference_type": "a",
            "answers": [
                { 0: 0, 1: 1 }
            ]
        }),
        ({
            "name": "two-options",
            "upgrades": [
                { "from_version": 0, "to_version": 1, "preference_type": "a" },
                { "from_version": 0, "to_version": 1, "preference_type": "a" }
            ],
            "destination": 2,
            "preference_type": "a",
            "answers": [
                { 0: 0 },
                { 0: 1 }
            ]
        }),
        ({
            "name": "shortcut",<commit_msg>Fix destination version for test<commit_after># Copyright (c) 2015 <NAME>.V.
# Cura is released under the terms of the AGPLv3 or higher.

from UM.Application import Application #To use the plug-in manager.
from UM.PluginObject import PluginObject #To create artificial plug-ins.
from UM.VersionUpgrade import VersionUpgrade
from UM.VersionUpgradeManager import VersionUpgradeManager

import pytest

##  Tests the version upgrade manager.
class TestVersionUpgradeManager():
    ##  Executed before the first test function is executed.
    def setup_method(self, method):
        self._upgrade_manager = VersionUpgradeManager()

    ##  Executed after the last test function was executed.
    def teardown_method(self, method):
        pass

    ##  The individual test cases for shortest upgrade paths.
    #
    #   Each entry contains a list of possible upgrades. Each upgrade has a
    #   from_version, a to_version and a preference_type field. Each entry also
    #   has a destination version to upgrade to and a preference type to filter
    #   on. Each entry has a list of possible answers, each of which is a
    #   mapping of version numbers to indices referring to upgrades in the input
    #   list. Lastly, each entry has a name for debugging.
    test_shortest_paths_data = [
        ({
            "name": "two-step",
            "upgrades": [
                { "from_version": 0, "to_version": 1, "preference_type": "a" },
                { "from_version": 1, "to_version": 2, "preference_type": "a" }
            ],
            "destination": 2,
            "preference_type": "a",
            "answers": [
                { 0: 0, 1: 1 }
            ]
        }),
        ({
            "name": "two-options",
            "upgrades": [
                { "from_version": 0, "to_version": 1, "preference_type": "a" },
                { "from_version": 0, "to_version": 1, "preference_type": "a" }
            ],
            "destination": 1,
            "preference_type": "a",
            "answers": [
                { 0: 0 },
                { 0: 1 }
            ]
        }),
        ({
            "name": "shortcut",
{'fraction_non_alphanumeric': 0.10035252643948296, 'fraction_numerical': 0.010810810810810811, 'mean_word_length': 2.07959479015919, 'pattern_counts': {'":': 46, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6809469', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1154, 'n_words': 411}