def testDoubleConverter(self):
     """
     Test for Sdf.ValueTypeNames.Double
     """
     #
     value1 = Vt.Double(3.14)
     value2 = Vt.Double(9.98)
     sdfValueType = Sdf.ValueTypeNames.Double
     errSdfValueType = Sdf.ValueTypeNames.String
     #
     self.runTypeChecks(sdfValueType, value1, value2)
     self.runErrorHandlingChecks(sdfValueType, value1, errSdfValueType)
Example #2
0
    def test_ValueTypeName(self):
        self.assertEqual(Vt._test_ValueTypeName(True), 'bool')
        self.assertEqual(Vt._test_ValueTypeName(False), 'bool')
        self.assertEqual(Vt._test_ValueTypeName(0), 'int')
        self.assertEqual(Vt._test_ValueTypeName(1), 'int')

        self.assertEqual(Vt._test_ValueTypeName(Vt.Bool(True)), 'bool')
        self.assertEqual(Vt._test_ValueTypeName(Vt.UChar(100)),
                         'unsigned char')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Short(1234)), 'short')
        self.assertEqual(Vt._test_ValueTypeName(Vt.UShort(1234)),
                         'unsigned short')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Int(12345)), 'int')
        self.assertEqual(Vt._test_ValueTypeName(Vt.UInt(12345)),
                         'unsigned int')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Long(1234)), 'long')
        self.assertEqual(Vt._test_ValueTypeName(Vt.ULong(100)),
                         'unsigned long')

        self.assertEqual(Vt._test_ValueTypeName(Vt.Half(1.234)),
                         'pxr_half::half')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Float(1.234)), 'float')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Double(1.234)), 'double')

        # Make sure that Python strings end up as strings, unless they're
        # coerced via Vt.Token
        self.assertEqual(Vt._test_ValueTypeName('hello'), 'string')
        self.assertEqual(Vt._test_ValueTypeName(u'hello'), 'string')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Token('hello')), 'TfToken')
Example #3
0
    def test_ValueTypeName(self):
        self.assertEqual(Vt._test_ValueTypeName(True), 'bool')
        self.assertEqual(Vt._test_ValueTypeName(False), 'bool')
        self.assertEqual(Vt._test_ValueTypeName(0), 'int')
        self.assertEqual(Vt._test_ValueTypeName(1), 'int')

        self.assertEqual(Vt._test_ValueTypeName(Vt.Bool(True)), 'bool')
        self.assertEqual(Vt._test_ValueTypeName(Vt.UChar(100)), 'unsigned char')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Short(1234)), 'short')
        self.assertEqual(Vt._test_ValueTypeName(Vt.UShort(1234)), 'unsigned short')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Int(12345)), 'int')
        self.assertEqual(Vt._test_ValueTypeName(Vt.UInt(12345)), 'unsigned int')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Long(1234)), 'long')
        self.assertEqual(Vt._test_ValueTypeName(Vt.ULong(100)), 'unsigned long')

        self.assertEqual(Vt._test_ValueTypeName(Vt.Half(1.234)), 'half')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Float(1.234)), 'float')
        self.assertEqual(Vt._test_ValueTypeName(Vt.Double(1.234)), 'double')
Example #4
0
 "UInt":
 [Vt.UInt(4294967295),
  Vt.UIntArray([4294967293, 4294967294, 4294967295])],
 "UInt64": [
     Vt.UInt64(18446744073709551615),
     Vt.UInt64Array(
         [18446744073709551613, 18446744073709551614, 18446744073709551615])
 ],
 "Int64": [
     Vt.Int64(-9223372036854775808),
     Vt.Int64Array(
         [9223372036854775805, 9223372036854775806, 9223372036854775807])
 ],
 "Half": [Vt.Half(0.5), Vt.HalfArray([0.1, 0.2, 0.3])],
 "Float": [Vt.Float(0.6), Vt.FloatArray([0.7, 0.8, 0.9])],
 "Double": [Vt.Double(1.1), Vt.DoubleArray([1.2, 1.3, 1.4])],
 "String": ["this", ["is", "a", "test"]],
 "Token": ["t-this", ["t-is", "t-a", "t-test"]],
 "Int2": [Gf.Vec2i(1, 2), [Gf.Vec2i(3, 4),
                           Gf.Vec2i(5, 6),
                           Gf.Vec2i(7, 8)]],
 "Int3": [
     Gf.Vec3i(1, 2, 3),
     [Gf.Vec3i(3, 4, 5),
      Gf.Vec3i(5, 6, 7),
      Gf.Vec3i(7, 8, 9)]
 ],
 "Int4": [
     Gf.Vec4i(1, 2, 3, 4),
     [Gf.Vec4i(3, 4, 5, 6),
      Gf.Vec4i(5, 6, 7, 8),