def test_slerp_quaternion(self):
     node = self.create_node('SlerpQuaternion',
                             {'input1': [0.0, 0.0, 0.0, 1.0], 'input2': [1.0, 0.0, 0.0, 0.0], 'alpha': 0.5},
                             [0.7071, 0.0, 0.0, 0.7071])
     
     cmds.setAttr('{0}.{1}'.format(node, 'interpolationType'), 1)
     self.assertItemsAlmostEqual(cmds.getAttr('{0}.output'.format(node))[0], [-0.7071, 0.0, 0.0, 0.7071], 4)
    def test_clamp(self):
        node = self.create_node('Clamp', {
            'input': 5.0,
            'inputMin': 0.0,
            'inputMax': 2.0
        }, 2.0)

        cmds.setAttr('{0}.{1}'.format(node, 'input'), -1.0)
        self.assertAlmostEqual(cmds.getAttr('{0}.output'.format(node)), 0.0)
    def test_clamp_int(self):
        node = self.create_node('ClampInt', {
            'input': 5,
            'inputMin': 0,
            'inputMax': 2
        }, 2)

        cmds.setAttr('{0}.{1}'.format(node, 'input'), -1)
        self.assertAlmostEqual(cmds.getAttr('{0}.output'.format(node)), 0)
 def test_compare(self):
     node = self.create_node('Compare', {'input1': 0.01, 'input2': 0.01}, True)
     
     cmds.setAttr('{0}.{1}'.format(node, 'input2'), 1.0)
     cmds.setAttr('{0}.{1}'.format(node, 'operation'), 1)
     self.assertTrue(cmds.getAttr('{0}.output'.format(node)))
     
     cmds.setAttr('{0}.{1}'.format(node, 'operation'), 2)
     self.assertFalse(cmds.getAttr('{0}.output'.format(node)))
     
     cmds.setAttr('{0}.{1}'.format(node, 'operation'), 3)
     self.assertTrue(cmds.getAttr('{0}.output'.format(node)))
     
     cmds.setAttr('{0}.{1}'.format(node, 'operation'), 4)
     self.assertTrue(cmds.getAttr('{0}.output'.format(node)))
     
     cmds.setAttr('{0}.{1}'.format(node, 'operation'), 5)
     self.assertFalse(cmds.getAttr('{0}.output'.format(node)))
 def test_select_array(self):
     node = self.create_node('SelectArray', {'input1[0]': 1.0, 'input1[1]': 2.0,
                                             'input2[0]': -1.0, 'input2[1]': -2.0}, [1.0, 2.0])
     
     cmds.setAttr('{0}.{1}'.format(node, 'condition'), True)
     self.assertAlmostEqual(cmds.getAttr('{0}.output[0]'.format(node)), -1.0)
 def test_select(self):
     node = self.create_node('Select', {'input1': 1.0, 'input2': 2.0}, 1.0)
     
     cmds.setAttr('{0}.{1}'.format(node, 'condition'), True)
     self.assertAlmostEqual(cmds.getAttr('{0}.output'.format(node)), 2.0)