File: TestToolHandle.py

package info (click to toggle)
uranium 5.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,304 kB
  • sloc: python: 31,765; sh: 132; makefile: 12
file content (22 lines) | stat: -rw-r--r-- 661 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from unittest.mock import patch

import pytest

from UM.Scene.ToolHandle import ToolHandle

test_validate_data = [
    {"attribute": "LineMesh", "value": "whatever"},
    {"attribute": "SolidMesh", "value": "blorp"},
    {"attribute": "SelectionMesh", "value": "omgzomg"}
]

@pytest.mark.parametrize("data", test_validate_data)
def test_getAndSet(data):
    with patch("UM.Application.Application.getInstance"):
        tool_handle = ToolHandle()

    # Attempt to set the value
    getattr(tool_handle, "set" + data["attribute"])(data["value"])

    # Ensure that the value got set
    assert getattr(tool_handle, "get" + data["attribute"])() == data["value"]