コード例 #1
0
ファイル: SettingTest.py プロジェクト: fieldOfView/Uranium
class SettingTest(unittest.TestCase):
    def setUp(self):
        # Called before the first testfunction is executed
        self._setting = Setting("TestSetting", 10, "int")
        self._machine_settings = MachineSettings()
        category = SettingsCategory("TestCategory")
        #category.addSetting(self._setting)
        self._machine_settings.addSettingsCategory(category)
        self._machine_settings.loadSettingsFromFile(
            "tests/Settings/SettingData.json")

    def tearDown(self):
        # Called after the last testfunction was executed
        pass

    def test_getSettingByKey(self):
        self.assertEqual(
            self._machine_settings.getSettingByKey("TestSetting").getType(),
            self._setting.getType())
        self.assertEqual(
            self._machine_settings.getSettingByKey(
                "TestSetting").getDefaultValue(),
            self._setting.getDefaultValue())
        pass

    def test_category(self):
        pass

    def test_validatorTest(self):
        pass
コード例 #2
0
    def test_fillByDict(self, data):
        setting = Setting(self._machine_manager, "test", self._catalog)

        setting.fillByDict(data)

        assert setting.getType() == data["type"]
        assert setting.getDefaultValue() == data["default"]
        assert setting.getLabel() == data["label"]
        assert setting.getDescription() == data["description"]
        assert setting.isVisible()
コード例 #3
0
ファイル: TestSetting.py プロジェクト: Kiddo3D/Uranium
    def test_fillByDict(self, data):
        setting = Setting(self._machine_manager, "test", self._catalog)

        setting.fillByDict(data)

        assert setting.getType() == data["type"]
        assert setting.getDefaultValue() == data["default"]
        assert setting.getLabel() == data["label"]
        assert setting.getDescription() == data["description"]
        assert setting.isVisible()
コード例 #4
0
ファイル: TestSetting.py プロジェクト: Kiddo3D/Uranium
    def test_construct(self):
        # Most basic construction, only required arguments.
        setting = Setting(self._machine_manager, "test", self._catalog)

        # This check is mostly to see if the object was constructed properly
        assert isinstance(setting, Setting)
        assert setting.getKey() == "test"

        # Construct with keyword arguments
        setting = Setting(
            self._machine_manager, "test", self._catalog,
            label = "Test Setting",
            type = "string",
        )

        assert isinstance(setting, Setting)
        assert setting.getKey() == "test"
        assert setting.getLabel() == "Test Setting"
        assert setting.getType() == "string"
コード例 #5
0
ファイル: TestSetting.py プロジェクト: jf---/Uranium
    def test_fillByDict(self):
        setting = Setting(self._machine_manager, "test", self._catalog)

        data = {
            "type": "int",
            "default": 4,
            "label": "Test Setting",
            "description": "A Test Setting",
            "unit": "furlongs per fortnight",
            "visible": True
        }

        setting.fillByDict(data)

        self.assertEqual("int", setting.getType())
        self.assertEqual(4, setting.getDefaultValue())
        self.assertEqual("Test Setting", setting.getLabel())
        self.assertEqual("A Test Setting", setting.getDescription())
        self.assertEqual("furlongs per fortnight", setting.getUnit())
        self.assertTrue(setting.isVisible())
コード例 #6
0
    def test_construct(self):
        # Most basic construction, only required arguments.
        setting = Setting(self._machine_manager, "test", self._catalog)

        # This check is mostly to see if the object was constructed properly
        assert isinstance(setting, Setting)
        assert setting.getKey() == "test"

        # Construct with keyword arguments
        setting = Setting(
            self._machine_manager,
            "test",
            self._catalog,
            label="Test Setting",
            type="string",
        )

        assert isinstance(setting, Setting)
        assert setting.getKey() == "test"
        assert setting.getLabel() == "Test Setting"
        assert setting.getType() == "string"
コード例 #7
0
ファイル: SettingTest.py プロジェクト: derekhe/Uranium
class SettingTest(unittest.TestCase):
    def setUp(self):
        # Called before the first testfunction is executed
        self._setting = Setting("TestSetting",10,"int")
        self._machine_settings = MachineSettings()
        category = SettingsCategory("TestCategory")
        #category.addSetting(self._setting)
        self._machine_settings.addSettingsCategory(category)
        self._machine_settings.loadSettingsFromFile("tests/Settings/SettingData.json")

    def tearDown(self):
        # Called after the last testfunction was executed
        pass

    def test_getSettingByKey(self):
        self.assertEqual(self._machine_settings.getSettingByKey("TestSetting").getType(), self._setting.getType())
        self.assertEqual(self._machine_settings.getSettingByKey("TestSetting").getDefaultValue(), self._setting.getDefaultValue())
        pass

    def test_category(self):
        pass

    def test_validatorTest(self):
        pass