Construct with a specific type
(self)
| 92 | self.assertEqual(v.ToVTKObject(), o) |
| 93 | |
| 94 | def testTwoArgConstructor(self): |
| 95 | """Construct with a specific type""" |
| 96 | # construct with conversion to int |
| 97 | v = vtkVariant('10') |
| 98 | u = vtkVariant(v, VTK_INT) |
| 99 | self.assertEqual(u.GetType(), VTK_INT) |
| 100 | self.assertEqual(v.ToInt(), u.ToInt()) |
| 101 | |
| 102 | # construct with conversion to double |
| 103 | v = vtkVariant(10) |
| 104 | u = vtkVariant(v, VTK_DOUBLE) |
| 105 | self.assertEqual(u.GetType(), VTK_DOUBLE) |
| 106 | self.assertEqual(u.ToDouble(), 10.0) |
| 107 | |
| 108 | # failed conversion to vtkObject |
| 109 | v = vtkVariant(10) |
| 110 | u = vtkVariant(v, VTK_OBJECT) |
| 111 | self.assertEqual(u.IsValid(), False) |
| 112 | |
| 113 | def testAutomaticArgConversion(self): |
| 114 | """Automatic construction of variants to resolve args""" |
nothing calls this directly
no test coverage detected