コード例 #1
0
ファイル: test_styles.py プロジェクト: dseeni/Houdini-Toolbox
    def test_name(self):
        """Test the 'name' property."""
        value = MagicMock(spec=str)
        constant = styles.StyleConstant(None, None, None, None)
        constant._name = value

        self.assertEqual(constant.name, value)
コード例 #2
0
    def test___ne___different_type(self, mock_eq):
        """Test the ne operator when the other item isn't a StyleConstant."""
        constant = styles.StyleConstant(None, None, None, None)

        result = constant.__ne__(MagicMock())

        self.assertEqual(result, NotImplemented)
コード例 #3
0
ファイル: test_styles.py プロジェクト: dseeni/Houdini-Toolbox
    def test_file_path(self):
        """Test the 'file_path' property."""
        value = MagicMock(spec=str)
        constant = styles.StyleConstant(None, None, None, None)
        constant._file_path = value

        self.assertEqual(constant.file_path, value)
コード例 #4
0
    def test_shape(self):
        """Test the 'shape' property."""
        value1 = MagicMock(spec=str)
        constant = styles.StyleConstant(None, None, None, None)
        constant._shape = value1

        self.assertEqual(constant.shape, value1)
コード例 #5
0
    def test_color(self):
        """Test the 'color' property."""
        mock_color1 = MagicMock(spec=hou.Color)

        constant = styles.StyleConstant(None, None, None, None)
        constant._color = mock_color1

        self.assertEqual(constant.color, mock_color1)
コード例 #6
0
    def test___ne__(self, mock_eq):
        """Test the ne operator."""
        constant = styles.StyleConstant(None, None, None, None)

        mock_constant = MagicMock(spec=styles.StyleConstant)

        result = constant.__ne__(mock_constant)

        self.assertEqual(result, not mock_eq.return_value)
コード例 #7
0
    def test___hash__(self, mock_name_prop):
        """Test the hash operator."""
        constant = styles.StyleConstant(None, None, None, None)

        result = constant.__hash__()

        self.assertEqual(result, hash(constant.name))

        self.assertEqual(hash(constant), hash(constant.name))
コード例 #8
0
ファイル: test_styles.py プロジェクト: dseeni/Houdini-Toolbox
    def test_apply_to_node__none(self, mock_color, mock_shape):
        """Test applying to a node when no values will be set."""
        mock_node = MagicMock(spec=hou.Node)

        constant = styles.StyleConstant(None, None, None, None)

        constant.apply_to_node(mock_node)

        mock_node.setColor.assert_not_called()
        mock_node.setUserData.assert_not_called()
コード例 #9
0
ファイル: test_styles.py プロジェクト: dseeni/Houdini-Toolbox
    def test_color_type(self):
        """Test the 'color_type' property."""
        value1 = MagicMock(spec=str)
        constant = styles.StyleConstant(None, None, None, None)
        constant._color_type = value1

        self.assertEqual(constant.color_type, value1)

        value2 = MagicMock(spec=str)
        constant.color_type = value2
        self.assertEqual(constant._color_type, value2)
コード例 #10
0
ファイル: test_styles.py プロジェクト: dseeni/Houdini-Toolbox
    def test_apply_to_node__both(self, mock_color_prop, mock_shape_prop):
        """Test applying everything to a node."""
        mock_node = MagicMock(spec=hou.Node)

        constant = styles.StyleConstant(None, None, None, None)

        constant.apply_to_node(mock_node)

        mock_node.setColor.assert_called_with(mock_color_prop.return_value)
        mock_node.setUserData.assert_called_with("nodeshape",
                                                 mock_shape_prop.return_value)
コード例 #11
0
ファイル: test_styles.py プロジェクト: dseeni/Houdini-Toolbox
    def test___eq__(self, mock_name_prop):
        """Test the equality operator."""
        mock_name_prop.return_value = "name1"

        constant = styles.StyleConstant(None, None, None, None)

        mock_constant = MagicMock(spec=styles.StyleConstant)
        mock_constant.name = "name2"

        self.assertNotEqual(constant, mock_constant)

        mock_name_prop.return_value = "name"
        mock_constant.name = "name"

        self.assertEqual(constant, mock_constant)
コード例 #12
0
    def test___init__(self, mocker):
        """Test object initialization."""
        mock_name = mocker.MagicMock(spec=str)
        mock_color = mocker.MagicMock(spec=hou.Color)
        mock_color_type = mocker.MagicMock(spec=str)
        mock_shape = mocker.MagicMock(spec=str)
        mock_file_path = mocker.MagicMock(spec=str)

        constant = styles.StyleConstant(mock_name, mock_color, mock_color_type,
                                        mock_shape, mock_file_path)

        assert constant._name == mock_name
        assert constant._color == mock_color
        assert constant._color_type == mock_color_type
        assert constant._shape == mock_shape
        assert constant._file_path == mock_file_path
コード例 #13
0
ファイル: test_styles.py プロジェクト: dseeni/Houdini-Toolbox
    def test___init__(self):
        """Test the constructor"""
        mock_name = MagicMock(spec=str)
        mock_color = MagicMock(spec=hou.Color)
        mock_color_type = MagicMock(spec=str)
        mock_shape = MagicMock(spec=str)
        mock_file_path = MagicMock(spec=str)

        constant = styles.StyleConstant(mock_name, mock_color, mock_color_type,
                                        mock_shape, mock_file_path)

        self.assertEqual(constant._name, mock_name)
        self.assertEqual(constant._color, mock_color)
        self.assertEqual(constant._color_type, mock_color_type)
        self.assertEqual(constant._shape, mock_shape)
        self.assertEqual(constant._file_path, mock_file_path)
コード例 #14
0
 def _create():
     return styles.StyleConstant(None, None, None, None)