Best Python code snippet using Testify_python
test_solve.py
Source:test_solve.py
...33 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), s.get)34 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), float, s)35 s.set(2)36 self.failUnlessEqual(s.is_set(), 1)37 self.failUnlessAlmostEqual(s.get(), 2.0)38 self.failUnlessAlmostEqual(float(s), 2.0)39 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), s.set, 3)40 self.failUnlessEqual(s.is_set(), 1)41 self.failUnlessAlmostEqual(s.get(), 2.0)42 self.failUnlessAlmostEqual(float(s), 2.0)43 s = scalar(2)44 self.failUnlessEqual(scalar(2).is_set(), 1)45 self.failUnlessAlmostEqual(s.get(), 2.0)46 self.failUnlessAlmostEqual(float(s), 2.0)47 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), s.set, 3)48 self.failUnlessEqual(s.is_set(), 1)49 self.failUnlessAlmostEqual(s.get(), 2.0)50 self.failUnlessAlmostEqual(float(s), 2.0)51class VectorTestCase(unittest.TestCase):52 def testInit(self):53 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), vector, 0, 0)54 self.failUnlessEqual(str(vector(2)), "unnamed_vector{=(unnamed_vector[0], unnamed_vector[1])}")55 self.failUnlessEqual(str(vector([1, 2])), "unnamed_vector{=(unnamed_vector[0]{=1.0}, unnamed_vector[1]{=2.0})}")56 self.failUnlessEqual(str(vector(3, "a")), "a{=(a[0], a[1], a[2])}")57 self.failUnlessEqual(str(vector([3, 2, 1], "a")), "a{=(a[0]{=3.0}, a[1]{=2.0}, a[2]{=1.0})}")58 def testAccess(self):59 a = vector(2)60 self.failUnlessEqual(str(a), "unnamed_vector{=(unnamed_vector[0], unnamed_vector[1])}")61 self.failUnlessEqual(a[0].is_set(), 0)62 self.failUnlessEqual(a.x.is_set(), 0)63 self.failUnlessEqual(a[1].is_set(), 0)64 self.failUnlessEqual(a.y.is_set(), 0)65 self.failUnlessRaises(IndexError, operator.__getitem__, a, 2)66 self.failUnlessRaises(IndexError, getattr, a, "z")67 a[0].set(2)68 self.failUnlessEqual(str(a), "unnamed_vector{=(unnamed_vector[0]{=2.0}, unnamed_vector[1])}")69 self.failUnlessAlmostEqual(a[0].get(), 2.0)70 self.failUnlessAlmostEqual(float(a[0]), 2.0)71 self.failUnlessAlmostEqual(a.x.get(), 2.0)72 self.failUnlessAlmostEqual(float(a.x), 2.0)73 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), a[1].get)74 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), float, a[1])75 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), a.y.get)76 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), float, a.y)77 self.failUnlessEqual(a[0].is_set(), 1)78 self.failUnlessEqual(a.x.is_set(), 1)79 self.failUnlessEqual(a[1].is_set(), 0)80 self.failUnlessEqual(a.y.is_set(), 0)81 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), a[0].set, 3)82 self.failUnlessAlmostEqual(a[0].get(), 2.0)83 self.failUnlessAlmostEqual(float(a[0]), 2.0)84 self.failUnlessAlmostEqual(a.x.get(), 2.0)85 self.failUnlessAlmostEqual(float(a.x), 2.0)86 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), a[1].get)87 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), float, a[1])88 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), a.y.get)89 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), float, a.y)90 self.failUnlessEqual(a[0].is_set(), 1)91 self.failUnlessEqual(a.x.is_set(), 1)92 self.failUnlessEqual(a[1].is_set(), 0)93 self.failUnlessEqual(a.y.is_set(), 0)94 a[1].set(3)95 self.failUnlessEqual(str(a), "unnamed_vector{=(unnamed_vector[0]{=2.0}, unnamed_vector[1]{=3.0})}")96 self.failUnlessAlmostEqual(a[0].get(), 2.0)97 self.failUnlessAlmostEqual(float(a[0]), 2.0)98 self.failUnlessAlmostEqual(a.x.get(), 2.0)99 self.failUnlessAlmostEqual(float(a.x), 2.0)100 self.failUnlessAlmostEqual(a[1].get(), 3.0)101 self.failUnlessAlmostEqual(float(a[1]), 3.0)102 self.failUnlessAlmostEqual(a.y.get(), 3.0)103 self.failUnlessAlmostEqual(float(a.y), 3.0)104 self.failUnlessEqual(a[0].is_set(), 1)105 self.failUnlessEqual(a.x.is_set(), 1)106 self.failUnlessEqual(a[1].is_set(), 1)107 self.failUnlessEqual(a.y.is_set(), 1)108 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), a[0].set, 4)109 self.failUnlessAlmostEqual(a[0].get(), 2.0)110 self.failUnlessAlmostEqual(float(a[0]), 2.0)111 self.failUnlessAlmostEqual(a.x.get(), 2.0)112 self.failUnlessAlmostEqual(float(a.x), 2.0)113 self.failUnlessAlmostEqual(a[1].get(), 3.0)114 self.failUnlessAlmostEqual(float(a[1]), 3.0)115 self.failUnlessAlmostEqual(a.y.get(), 3.0)116 self.failUnlessAlmostEqual(float(a.y), 3.0)117 self.failUnlessEqual(a[0].is_set(), 1)118 self.failUnlessEqual(a.x.is_set(), 1)119 self.failUnlessEqual(a[1].is_set(), 1)120 self.failUnlessEqual(a.y.is_set(), 1)121 a = vector([1, 2, 3])122 self.failUnlessEqual(str(a.x), "unnamed_vector[0]{=1.0}")123 self.failUnlessEqual(str(a.y), "unnamed_vector[1]{=2.0}")124 self.failUnlessEqual(str(a.z), "unnamed_vector[2]{=3.0}")125 def testLen(self):126 for i in range(1, 5):127 a = vector(i)128 self.failUnlessEqual(len(a), i)129 self.failUnlessEqual(str(a), "unnamed_vector{=(" + ", ".join(["unnamed_vector[%i]" % j for j in range(i)]) + ")}")130 def testMath(self):131 self.failUnlessEqual(str(-vector(2, "a")), "unnamed_vector{=(unnamed_scalar{=-1.0} * a[0], unnamed_scalar{=-1.0} * a[1])}")132 self.failUnlessEqual(str(vector(2, "a") + vector(2, "b")), "unnamed_vector{=(a[0] + b[0], a[1] + b[1])}")133 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, 1, vector(2))134 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, vector(2), 1)135 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, scalar(), vector(2))136 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, vector(2), scalar())137 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, scalar() + scalar(), vector(2))138 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, vector(2), scalar() + scalar())139 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, vector(2), vector(3))140 self.failUnlessEqual(str(vector(2, "a") - vector(2, "b")), "unnamed_vector{=(unnamed_scalar{=-1.0} * b[0] + a[0], unnamed_scalar{=-1.0} * b[1] + a[1])}")141 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, 1, vector(2))142 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, vector(2), 1)143 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, scalar(), vector(2))144 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, vector(2), scalar())145 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, scalar() + scalar(), vector(2))146 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, vector(2), scalar() + scalar())147 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, vector(2), vector(3))148 self.failUnlessEqual(str(2 * vector(2, "a")), "unnamed_vector{=(a[0] * unnamed_scalar{=2.0}, a[1] * unnamed_scalar{=2.0})}")149 self.failUnlessEqual(str(vector(2, "a") * 2), "unnamed_vector{=(a[0] * unnamed_scalar{=2.0}, a[1] * unnamed_scalar{=2.0})}")150 self.failUnlessEqual(str(scalar(name="s") * vector(2, "a")), "unnamed_vector{=(a[0] * s, a[1] * s)}")151 self.failUnlessEqual(str(scalar(name="s") * (vector(2, "a") + vector(2, "b"))), "unnamed_vector{=(a[0] * s + b[0] * s, a[1] * s + b[1] * s)}")152 self.failUnlessEqual(str((scalar(name="s") + scalar(name="t")) * vector(2, "a")), "unnamed_vector{=(a[0] * s + a[0] * t, a[1] * s + a[1] * t)}")153 self.failUnlessEqual(str((scalar(name="s") + scalar(name="t")) * (vector(2, "a") + vector(2, "b"))), "unnamed_vector{=(a[0] * s + b[0] * s + a[0] * t + b[0] * t, a[1] * s + b[1] * s + a[1] * t + b[1] * t)}")154 self.failUnlessEqual(str(vector(2, "a") * scalar(name="s")), "unnamed_vector{=(a[0] * s, a[1] * s)}")155 self.failUnlessEqual(str(vector(2, "a") * vector(2, "b")), "a[0] * b[0] + a[1] * b[1]")156 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__mul__, vector(2, "a"), vector(3))157 self.failUnlessEqual(str(vector(2, "a") / 2.0), "unnamed_vector{=(unnamed_scalar{=0.5} * a[0], unnamed_scalar{=0.5} * a[1])}")158 self.failUnlessEqual(str(vector(2, "a") / 2), "unnamed_vector{=(unnamed_scalar{=0.0} * a[0], unnamed_scalar{=0.0} * a[1])}") # integer logic!159 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, scalar(), vector(1))160 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, scalar() + scalar(), vector(1))161 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, vector(1), scalar())162 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, vector(1), scalar() + scalar())163 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, vector(1), vector(1))164class MatrixTestCase(unittest.TestCase):165 def testInit(self):166 self.failUnlessEqual(str(matrix((2, 3))), "unnamed_matrix{=((unnamed_matrix[0, 0], unnamed_matrix[0, 1], unnamed_matrix[0, 2]), (unnamed_matrix[1, 0], unnamed_matrix[1, 1], unnamed_matrix[1, 2]))}")167 self.failUnlessEqual(str(matrix([[1, 2, 3], [4, 5, 6]])), "unnamed_matrix{=((unnamed_matrix[0, 0]{=1.0}, unnamed_matrix[0, 1]{=2.0}, unnamed_matrix[0, 2]{=3.0}), (unnamed_matrix[1, 0]{=4.0}, unnamed_matrix[1, 1]{=5.0}, unnamed_matrix[1, 2]{=6.0}))}")168 self.failUnlessEqual(str(matrix((2, 3), "a")), "a{=((a[0, 0], a[0, 1], a[0, 2]), (a[1, 0], a[1, 1], a[1, 2]))}")169 self.failUnlessEqual(str(matrix([[1, 2, 3], [4, 5, 6]], "a")), "a{=((a[0, 0]{=1.0}, a[0, 1]{=2.0}, a[0, 2]{=3.0}), (a[1, 0]{=4.0}, a[1, 1]{=5.0}, a[1, 2]{=6.0}))}")170 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), matrix, [[1, 2, 3], [4, 5]])171 def testLen(self):172 for rows in range(1, 5):173 for cols in range(1, 5):174 A = matrix((rows, cols))175 self.failUnlessEqual(A.getnumberofrows(), rows)176 self.failUnlessEqual(A.getnumberofcols(), cols)177 self.failUnlessEqual(str(A), "unnamed_matrix{=(" + ", ".join(["(" + ", ".join(["unnamed_matrix[%i, %i]" % (i, j) for j in range(cols)]) + ")" for i in range(rows)]) + ")}")178 def testAccess(self):179 A = matrix([2, 3])180 self.failUnlessEqual(str(A), "unnamed_matrix{=((unnamed_matrix[0, 0], unnamed_matrix[0, 1], unnamed_matrix[0, 2]), (unnamed_matrix[1, 0], unnamed_matrix[1, 1], unnamed_matrix[1, 2]))}")181 self.failUnlessEqual(A[0, 0].is_set(), 0)182 self.failUnlessEqual(A[1, 0].is_set(), 0)183 self.failUnlessRaises(IndexError, operator.__getitem__, A, (2, 0))184 self.failUnlessEqual(A[0, 1].is_set(), 0)185 self.failUnlessEqual(A[1, 1].is_set(), 0)186 self.failUnlessEqual(A[0, 2].is_set(), 0)187 self.failUnlessEqual(A[1, 2].is_set(), 0)188 self.failUnlessRaises(IndexError, operator.__getitem__, A, (0, 3))189 A[0, 0].set(1)190 self.failUnlessEqual(A[0, 0].is_set(), 1)191 self.failUnlessEqual(A[0, 1].is_set(), 0)192 self.failUnlessEqual(A[1, 0].is_set(), 0)193 self.failUnlessAlmostEqual(A[0, 0].get(), 1.0)194 self.failUnlessAlmostEqual(float(A[0, 0]), 1.0)195 def testMath(self):196 self.failUnlessEqual(str(-matrix([2, 3], "A")), "unnamed_matrix{=((unnamed_scalar{=-1.0} * A[0, 0], unnamed_scalar{=-1.0} * A[0, 1], unnamed_scalar{=-1.0} * A[0, 2]), (unnamed_scalar{=-1.0} * A[1, 0], unnamed_scalar{=-1.0} * A[1, 1], unnamed_scalar{=-1.0} * A[1, 2]))}")197 self.failUnlessEqual(str(matrix([2, 3], "A") + matrix([2, 3], "B")), "unnamed_matrix{=((A[0, 0] + B[0, 0], A[0, 1] + B[0, 1], A[0, 2] + B[0, 2]), (A[1, 0] + B[1, 0], A[1, 1] + B[1, 1], A[1, 2] + B[1, 2]))}")198 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, matrix([2, 3]), 1)199 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, matrix([2, 3]), scalar())200 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, matrix([2, 3]), scalar() + scalar())201 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, matrix([2, 3]), vector(2))202 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, matrix([2, 3]), vector(3))203 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, matrix([2, 3]), matrix([2, 4]))204 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, matrix([2, 3]), matrix([3, 3]))205 self.failUnlessEqual(str(matrix([2, 3], "A") - matrix([2, 3], "B")), "unnamed_matrix{=((unnamed_scalar{=-1.0} * B[0, 0] + A[0, 0], unnamed_scalar{=-1.0} * B[0, 1] + A[0, 1], unnamed_scalar{=-1.0} * B[0, 2] + A[0, 2]), (unnamed_scalar{=-1.0} * B[1, 0] + A[1, 0], unnamed_scalar{=-1.0} * B[1, 1] + A[1, 1], unnamed_scalar{=-1.0} * B[1, 2] + A[1, 2]))}")206 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, matrix([2, 3]), 1)207 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, matrix([2, 3]), scalar())208 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, matrix([2, 3]), scalar() + scalar())209 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, matrix([2, 3]), vector(2))210 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, matrix([2, 3]), vector(3))211 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, matrix([2, 3]), matrix([2, 4]))212 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, matrix([2, 3]), matrix([3, 3]))213 self.failUnlessEqual(str(2 * matrix([2, 3], "A")), "unnamed_matrix{=((A[0, 0] * unnamed_scalar{=2.0}, A[0, 1] * unnamed_scalar{=2.0}, A[0, 2] * unnamed_scalar{=2.0}), (A[1, 0] * unnamed_scalar{=2.0}, A[1, 1] * unnamed_scalar{=2.0}, A[1, 2] * unnamed_scalar{=2.0}))}")214 self.failUnlessEqual(str(matrix([2, 3], "A") * 2), "unnamed_matrix{=((A[0, 0] * unnamed_scalar{=2.0}, A[0, 1] * unnamed_scalar{=2.0}, A[0, 2] * unnamed_scalar{=2.0}), (A[1, 0] * unnamed_scalar{=2.0}, A[1, 1] * unnamed_scalar{=2.0}, A[1, 2] * unnamed_scalar{=2.0}))}")215 self.failUnlessEqual(str(matrix([2, 3], "A") * vector(3, "a")), "unnamed_vector{=(A[0, 0] * a[0] + A[0, 1] * a[1] + A[0, 2] * a[2], A[1, 0] * a[0] + A[1, 1] * a[1] + A[1, 2] * a[2])}")216 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__mul__, vector(2, "a"), matrix([2, 3], "A"))217 self.failUnlessEqual(str(matrix([2, 3], "A") * matrix([3, 2], "B")), "unnamed_matrix{=((A[0, 0] * B[0, 0] + A[0, 1] * B[1, 0] + A[0, 2] * B[2, 0], A[0, 0] * B[0, 1] + A[0, 1] * B[1, 1] + A[0, 2] * B[2, 1]), (A[1, 0] * B[0, 0] + A[1, 1] * B[1, 0] + A[1, 2] * B[2, 0], A[1, 0] * B[0, 1] + A[1, 1] * B[1, 1] + A[1, 2] * B[2, 1]))}")218 self.failUnlessEqual(str(matrix([2, 3], "A") / 2.0), "unnamed_matrix{=((unnamed_scalar{=0.5} * A[0, 0], unnamed_scalar{=0.5} * A[0, 1], unnamed_scalar{=0.5} * A[0, 2]), (unnamed_scalar{=0.5} * A[1, 0], unnamed_scalar{=0.5} * A[1, 1], unnamed_scalar{=0.5} * A[1, 2]))}")219 self.failUnlessEqual(str(matrix([2, 3], "A") / 2), "unnamed_matrix{=((unnamed_scalar{=0.0} * A[0, 0], unnamed_scalar{=0.0} * A[0, 1], unnamed_scalar{=0.0} * A[0, 2]), (unnamed_scalar{=0.0} * A[1, 0], unnamed_scalar{=0.0} * A[1, 1], unnamed_scalar{=0.0} * A[1, 2]))}")220 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, scalar(), matrix([2, 3]))221 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, scalar() + scalar(), matrix([2, 3]))222 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, vector(1), matrix([2, 3]))223 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, matrix([2, 3]), scalar())224 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, matrix([2, 3]), scalar() + scalar())225 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, matrix([2, 3]), vector(1))226 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, matrix([2, 3]), matrix([2, 3]))227class TrafoTestCase(unittest.TestCase):228 def testInit(self):229 self.failUnlessEqual(str(trafo((2, 3))), "unnamed_trafo{=(matrix: unnamed_trafo_matrix{=((unnamed_trafo_matrix[0, 0], unnamed_trafo_matrix[0, 1], unnamed_trafo_matrix[0, 2]), (unnamed_trafo_matrix[1, 0], unnamed_trafo_matrix[1, 1], unnamed_trafo_matrix[1, 2]))}, vector: unnamed_trafo_vector{=(unnamed_trafo_vector[0], unnamed_trafo_vector[1])})}")230 self.failUnlessEqual(str(trafo((2, 3), "A")), "A{=(matrix: A_matrix{=((A_matrix[0, 0], A_matrix[0, 1], A_matrix[0, 2]), (A_matrix[1, 0], A_matrix[1, 1], A_matrix[1, 2]))}, vector: A_vector{=(A_vector[0], A_vector[1])})}")231 self.failUnlessEqual(str(trafo((matrix([2, 3], "B"), vector(2, "c")), "A")), "A{=(matrix: B{=((B[0, 0], B[0, 1], B[0, 2]), (B[1, 0], B[1, 1], B[1, 2]))}, vector: c{=(c[0], c[1])})}")232 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), trafo, (matrix([2, 3]), vector(3)))233 def testAccess(self):234 m = matrix([2, 3])235 v = vector(2)236 t = trafo((m, v))237 self.failUnlessEqual(t.getmatrix(), m)238 self.failUnlessEqual(t.getvector(), v)239 def testMath(self):240 self.failUnlessEqual(str(-trafo([2, 3], "A")), str(trafo((-matrix([2, 3], "A_matrix"), -vector(2, "A_vector")))))241 self.failUnlessEqual(str(trafo([2, 3], "A") + trafo([2, 3], "B")), str(trafo((matrix([2, 3], "A_matrix") + matrix([2, 3], "B_matrix"), vector(2, "A_vector") + vector(2, "B_vector")))))242 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, 1, trafo([2, 3]))243 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, trafo([2, 3]), 1)244 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, scalar(), trafo([2, 3]))245 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, trafo([2, 3]), scalar())246 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, scalar() + scalar(), trafo([2, 3]))247 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, trafo([2, 3]), scalar() + scalar())248 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, vector(2), trafo([2, 3]))249 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, trafo([2, 3]), vector(2))250 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, vector(3), trafo([2, 3]))251 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, trafo([2, 3]), vector(3))252 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, matrix([2, 3]), trafo([2, 3]))253 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, trafo([2, 3]), matrix([2, 3]))254 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, trafo([2, 3]), trafo([2, 4]))255 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__add__, trafo([2, 3]), trafo([3, 3]))256 self.failUnlessEqual(str(trafo([2, 3], "A") - trafo([2, 3], "B")), str(trafo((matrix([2, 3], "A_matrix") - matrix([2, 3], "B_matrix"), vector(2, "A_vector") - vector(2, "B_vector")))))257 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, 1, trafo([2, 3]))258 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, trafo([2, 3]), 1)259 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, scalar(), trafo([2, 3]))260 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, trafo([2, 3]), scalar())261 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, scalar() + scalar(), trafo([2, 3]))262 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, trafo([2, 3]), scalar() + scalar())263 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, vector(2), trafo([2, 3]))264 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, trafo([2, 3]), vector(2))265 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, vector(3), trafo([2, 3]))266 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, trafo([2, 3]), vector(3))267 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, matrix([2, 3]), trafo([2, 3]))268 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, trafo([2, 3]), matrix([2, 3]))269 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, trafo([2, 3]), trafo([2, 4]))270 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__sub__, trafo([2, 3]), trafo([3, 3]))271 self.failUnlessEqual(str(trafo([2, 3], "A") * trafo([3, 4], "B")), str(trafo((matrix([2, 3], "A_matrix") * matrix([3, 4], "B_matrix"), vector(2, "A_vector") + matrix([2, 3], "A_matrix") * vector(3, "B_vector")))))272 self.failUnlessEqual(str(2 * trafo([2, 3], "A")), str(trafo((2 * matrix([2, 3], "A_matrix"), 2 * vector(2, "A_vector")))))273 self.failUnlessEqual(str(trafo([2, 3], "A") * 2), str(trafo((matrix([2, 3], "A_matrix") * 2, vector(2, "A_vector") * 2))))274 self.failUnlessEqual(str(scalar() * trafo([2, 3], "A")), str(trafo((scalar() * matrix([2, 3], "A_matrix"), scalar() * vector(2, "A_vector")))))275 self.failUnlessEqual(str(trafo([2, 3], "A") * scalar()), str(trafo((matrix([2, 3], "A_matrix") * scalar(), vector(2, "A_vector") * scalar()))))276 self.failUnlessEqual(str((scalar() + scalar()) * trafo([2, 3], "A")), str(trafo(((scalar() + scalar()) * matrix([2, 3], "A_matrix"), (scalar() + scalar()) * vector(2, "A_vector")))))277 self.failUnlessEqual(str(trafo([2, 3], "A") * (scalar() + scalar())), str(trafo((matrix([2, 3], "A_matrix") * (scalar() + scalar()), vector(2, "A_vector") * (scalar() + scalar())))))278 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__mul__, vector(2), trafo([2, 3]))279 self.failUnlessEqual(str(trafo([2, 3], "A") * vector(3, "a")), str(matrix([2, 3], "A_matrix") * vector(3, "a") + vector(2, "A_vector")))280 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__mul__, trafo([2, 3]), vector(2))281 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__mul__, matrix([3, 2]), trafo([2, 3]))282 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__mul__, trafo([2, 3]), matrix([3, 2]))283 self.failUnlessEqual(str(trafo([2, 3], "A") / 2.0), str(trafo((matrix([2, 3], "A_matrix") / 2.0, vector(2, "A_vector") / 2.0))))284 self.failUnlessEqual(str(trafo([2, 3], "A") / 2), str(trafo((matrix([2, 3], "A_matrix") / 2, vector(2, "A_vector") / 2))))285 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, scalar(), trafo([2, 3]))286 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, scalar() + scalar(), trafo([2, 3]))287 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, vector(1), trafo([2, 3]))288 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, matrix([2, 3]), trafo([2, 3]))289 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, trafo([2, 3]), scalar())290 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, trafo([2, 3]), scalar() + scalar())291 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, trafo([2, 3]), vector(1))292 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, trafo([2, 3]), matrix([2, 3]))293 self.failUnlessRaises((RuntimeError, AttributeError, TypeError), operator.__div__, trafo([2, 3]), trafo([2, 3]))294class SolverTestCase(unittest.TestCase):295 def testScalars(self):296 solver = Solver()297 a = scalar()298 solver.eq(2 + a, 3)299 self.failUnlessAlmostEqual(float(a), 1)300 self.failUnlessRaises(RuntimeError, solver.eq, 2 + a, 3) # the solver is broken after that301 solver = Solver()302 a = scalar()303 b = scalar()304 solver.eq(2*a, b)305 solver.eq(2 + a + b, 5)306 self.failUnlessAlmostEqual(float(a), 1)307 self.failUnlessAlmostEqual(float(b), 2)308 a = scalar()309 b = scalar()310 solver.eq(a, b)311 self.failUnlessRaises(Exception, solver.eq, a, b)312 def testVector(self):313 solver = Solver()314 a = vector(2)315 solver.eq(vector([1, 2]) + a, vector([3, 3]))316 self.failUnlessAlmostEqual(float(a.x), 2)317 self.failUnlessAlmostEqual(float(a.y), 1)318 b = vector(2)319 solver.eq(a*b) # => solver.eq(a*b, 0)320 solver.eq(b.y, 2)321 self.failUnlessAlmostEqual(float(b.x), -1)322 def testMatrix(self):323 solver = Solver()324 A = matrix([2, 2])325 solver.eq(A*vector([1, -1]), vector([2, 0]))326 solver.eq(A*vector([1, 1]), vector([0, 2]))327 self.failUnlessAlmostEqual(float(A[0, 0]), 1)328 self.failUnlessAlmostEqual(float(A[0, 1]), -1)329 self.failUnlessAlmostEqual(float(A[1, 0]), 1)330 self.failUnlessAlmostEqual(float(A[1, 1]), 1)331 B = matrix([2, 2])332 solver.eq(A*B, identitymatrix(2))333 self.failUnlessAlmostEqual(float(B[0, 0]), 0.5)334 self.failUnlessAlmostEqual(float(B[0, 1]), 0.5)335 self.failUnlessAlmostEqual(float(B[1, 0]), -0.5)336 self.failUnlessAlmostEqual(float(B[1, 1]), 0.5)337 self.failUnlessAlmostEqual(float((B * vector([2, 0]))[0]), 1)338 self.failUnlessAlmostEqual(float((B * vector([2, 0]))[1]), -1)339 self.failUnlessAlmostEqual(float((B * vector([0, 2]))[0]), 1)340 self.failUnlessAlmostEqual(float((B * vector([0, 2]))[1]), 1)341 def testTrafo(self):342 solver = Solver()343 A = trafo([2, 2])344 solver.eq(A.getmatrix()[0, 0], A.getmatrix()[1, 1]) # restrict to rotation + scaling + translation345 solver.eq(A.getmatrix()[0, 1], -A.getmatrix()[1, 0])346 solver.eq(A*vector([0, 1]), vector([-1, 2]))347 solver.eq(A*vector([1, 0]), vector([1, 4]))348 self.failUnlessEqual(float((A * vector([0, 0]))[0]), 1)349 self.failUnlessEqual(float((A * vector([0, 0]))[1]), 2)350 self.failUnlessEqual(float(A.getmatrix()[0, 0]), 0)351 self.failUnlessEqual(float(A.getmatrix()[0, 1]), -2)352 self.failUnlessEqual(float(A.getmatrix()[1, 0]), 2)353 self.failUnlessEqual(float(A.getmatrix()[1, 1]), 0)354 B = trafo([2, 2])...
test_moremath.py
Source:test_moremath.py
...50 51 52class test_specfunc(unittest.TestCase) :53 def test_cgammma(self) :54 self.failUnlessAlmostEqual(cgamma(1.).real, 1.0)55 self.failUnlessAlmostEqual(cgamma(0.5).real, sqrt(pi) )56 self.failUnlessAlmostEqual(cgamma(3j).real, 0.0112987) 57 self.failUnlessAlmostEqual(cgamma(3j).imag, -0.00643092)58 def test_gammma(self) :59 self.failUnlessAlmostEqual(gamma(1.), 1.0)60 self.failUnlessAlmostEqual(gamma(0.5), sqrt(pi) )61 62 # Test values from GSL63 self.failUnlessAlmostEqual(gamma(1.0+ 1.0/4096.0),0.9998591371459403421)64 self.failUnlessAlmostEqual(gamma(1.0+1.0/4096.0), 0.9998591371459403421)65 self.failUnlessAlmostEqual(gamma(1.0 + 1.0/32.0), 0.9829010992836269148)66 self.failUnlessAlmostEqual(gamma(2.0 +1.0/256.0), 1.0016577903733583299)67 self.failUnlessAlmostEqual(gamma(9.0), 40320.0)68 self.failUnlessAlmostEqual(gamma(10.0), 362880.0)69 self.failUnlessAlmostEqual(gamma(100.0)/9.332621544394415268e+155,1.0)70 self.failUnlessAlmostEqual(gamma(170.0)/4.269068009004705275e+304, 1.0)71 self.failUnlessAlmostEqual(gamma(171.0)/7.257415615307998967e+306,1.0)72 self.failUnlessAlmostEqual(gamma(-10.5), -2.640121820547716316e-07)73 self.failUnlessAlmostEqual(gamma(-11.25), 6.027393816261931672e-08)74 self.failUnlessAlmostEqual(gamma(-1.0+1.0/65536.0)/-65536.422805878,1.0)75 def test_lngamma(self) :76 # Test values from GSL77 self.failUnlessAlmostEqual(lngamma(100.0), 359.1342053695753 )78 self.failUnlessAlmostEqual(lngamma(1.0e-08), 18.420680738180208905)79 self.failUnlessAlmostEqual(lngamma(0.1), 2.252712651734205)80 self.failUnlessAlmostEqual(lngamma(1.0 + 1.0/256.0),-0.0022422226599611)81 self.failUnlessAlmostEqual(lngamma(2.0 + 1.0/256.0), 0.001656417755696)82 83 self.failUnlessAlmostEqual(lngamma(-1.0-1.0/65536.0), 11.09034843809004)84 self.failUnlessAlmostEqual(lngamma(-1.0-1.0/268435456.0), 19.4081210541)85 86 87 def test_clngamma(self) :88 self.failUnlessAlmostEqual(clngamma(0.5+ 2.5j).real, -3.00805,5 ) 89 self.failUnlessAlmostEqual(clngamma(0.5+ 2.5j).imag, -0.192442,6 ) 90 91 def test_factorial(self) :92 self.assertEqual( factorial(3), 6)93 for n in range(1,30) :94 fac1 = factorial(n)95 fac2 =factorial(n+1)96 self.assertAlmostEqual( fac2/fac1, n+1) 97 def test_digammma(self) :98 self.failUnlessAlmostEqual(digamma(1.), -euler_gamma)99 self.failUnlessAlmostEqual(digamma(0.5), -euler_gamma - 2* log(2) )100 101 # Test values from GSL102 self.failUnlessAlmostEqual(digamma(2), 0.42278433509846713939)103 self.failUnlessAlmostEqual(digamma(3), 0.92278433509846713939)104 self.failUnlessAlmostEqual(digamma(4), 1.2561176684318004727)105 self.failUnlessAlmostEqual(digamma(5), 1.5061176684318004727)106 self.failUnlessAlmostEqual(digamma(100), 4.600161852738087400)107 self.failUnlessAlmostEqual(digamma(110), 4.695928024251535633)108 self.failUnlessAlmostEqual(digamma(5000), 8.517093188082904107)109 self.failUnlessAlmostEqual(digamma(-10.5), 2.3982391295357816134)110 def test_trigamma(self) :111 self.failUnlessAlmostEqual(trigamma(10.0), 112 -(9778141./6350400) +pi*pi/6.) 113 self.failUnlessAlmostEqual(trigamma(2.0), pi*pi/6. -1.) 114 self.failUnlessAlmostEqual(trigamma(1.0), pi*pi/6.)115 self.failUnlessAlmostEqual(trigamma(0.5), pi*pi/2.)116 self.failUnlessAlmostEqual(trigamma(100.), 0.0100502)117 self.failUnlessAlmostEqual(trigamma(1000.), 0.0010005)118 def test_cdigamma(self) :119 self.failUnlessAlmostEqual(cdigamma(0.5+ 2.5j).real, 0.909417,5 ) 120 self.failUnlessAlmostEqual(cdigamma(0.5+ 2.5j).imag, 1.5708,5 ) 121 def test_ctrigamma(self) :122 self.failUnlessAlmostEqual(ctrigamma(0.5+ 2.5j).real, 2.97473E-6,5 ) 123 self.failUnlessAlmostEqual(ctrigamma(0.5+ 2.5j).imag, -0.405685,5)124 def test_incomplete_gamma(self) :125 self.failUnlessAlmostEqual(incomplete_gamma(10.0,0.), gamma(10.) )126 # Various test values taken from GSL127 self.failUnlessAlmostEqual(incomplete_gamma( 0.001, 0.001), 6.3087159394864007261 )128 self.failUnlessAlmostEqual(incomplete_gamma( 1.0, 0.001), 0.99900049983337499167, 2 )129 self.failUnlessAlmostEqual(incomplete_gamma( 10.0, 0.001), 362880.0 )130 self.failUnlessAlmostEqual(incomplete_gamma( 0.001, 1.0),0.21948181320730279613,5 )131 self.failUnlessAlmostEqual(incomplete_gamma( 10.0, 1.0)/ 362879.95956592242045,1.0, 6 )132 self.failUnlessAlmostEqual(incomplete_gamma(100.0, 1.0)/ 9.3326215443944152682e+155 , 1.0)133 self.failUnlessAlmostEqual(incomplete_gamma( 0.001, 100.0), 3.7006367674063550631e-46 )134 self.failUnlessAlmostEqual(incomplete_gamma( 1.0, 100.0), 3.7200759760208359630e-44 )135 self.failUnlessAlmostEqual(incomplete_gamma( 10.0, 100.0), 4.0836606309106112723e-26 )136 137 # Check limiting values138 self.failUnlessAlmostEqual(normalized_incomplete_gamma( 10., 0.0) , 1.0) 139 self.failUnlessAlmostEqual(normalized_incomplete_gamma( 10., 10000.0) , 0.0) 140 141 142 def test_entropy(self) :143 ent = entropy( (1.,1.) )144 self.failUnlessAlmostEqual(ent, log(2) )145 146 def test_entropy_with_flat_distribution(self) :147 for n in range(1, 100) :148 pvec = [ 1./n for i in range(0,n)]149 ent = entropy(pvec)150 self.failUnlessAlmostEqual(ent, log(n) )151 152 def test_entropy_unnormalized(self) : 153 for n in range(1, 100) :154 pvec = [ 1. for i in range(0,n)]155 ent = entropy(pvec)156 self.failUnlessAlmostEqual(ent, log(n) )157 158 def test_entropy_with_integer(self) :159 ent = entropy( (1,1,1,0) )160 self.failUnlessAlmostEqual(ent, log(3) )161 162 def test_entropy_with_short_pvec(self) :163 ent = entropy( (1,) )164 self.failUnlessEqual(ent, 0 )165 ent = entropy( (1,0,0,0,0) )166 self.failUnlessEqual(ent, 0 ) 167 168 def test_entropy_invalid_pvec(self):169 self.failUnlessRaises(ValueError, entropy, () )170 self.failUnlessRaises(ValueError, entropy, (1,-1) )171 172 def test_entropy_base(self) :173 ent = entropy( (2,2,2,2,0),2 )174 self.failUnlessAlmostEqual(ent, 2)175if __name__ == '__main__':...
loadWorldSpaceTranslateJob_test.py
Source:loadWorldSpaceTranslateJob_test.py
...59 self.__files.append(util.expandFileName('testStaticLoadWorldSpaceTranslateJob.abc'))60 MayaCmds.AbcExport(j='-ws -root %s -file %s' % (root, self.__files[-1]))61 # reading test62 MayaCmds.AbcImport(self.__files[-1], mode='open')63 self.failUnlessAlmostEqual(0, MayaCmds.getAttr(root+'.translateX'), 3)64 self.failUnlessAlmostEqual(-5.909,65 MayaCmds.getAttr(root+'.translateY'), 3)66 self.failUnlessAlmostEqual(0, MayaCmds.getAttr(root+'.translateZ'), 3)67 self.failUnlessAlmostEqual(68.211,68 MayaCmds.getAttr(root+'.rotateX'), 3)69 self.failUnlessAlmostEqual(40.351,70 MayaCmds.getAttr(root+'.rotateY'), 3)71 self.failUnlessAlmostEqual(-90, MayaCmds.getAttr(root+'.rotateZ'), 3)72 self.failUnlessAlmostEqual(0.600, MayaCmds.getAttr(root+'.scaleX'), 3)73 self.failUnlessAlmostEqual(1.905, MayaCmds.getAttr(root+'.scaleY'), 3)74 self.failUnlessAlmostEqual(1.313, MayaCmds.getAttr(root+'.scaleZ'), 3)75 self.failUnlessAlmostEqual(0.539, MayaCmds.getAttr(root+'.shearXY'), 3)76 self.failUnlessAlmostEqual(0.782, MayaCmds.getAttr(root+'.shearXZ'), 3)77 self.failUnlessAlmostEqual(1.051, MayaCmds.getAttr(root+'.shearYZ'), 3)78 def testAnimLoadWorldSpaceTranslateJobReadWrite(self):79 nodeName = MayaCmds.polyCube(n='cube')80 root = nodeName[0]81 MayaCmds.setAttr(root+'.rotateX', 45)82 MayaCmds.setAttr(root+'.scaleX', 1.5)83 MayaCmds.setAttr(root+'.translateY', -1.95443)84 MayaCmds.setKeyframe(root, value=0, attribute='translateX', t=[1, 24])85 MayaCmds.setKeyframe(root, value=1, attribute='translateX', t=12)86 nodeName = MayaCmds.group()87 MayaCmds.setAttr(nodeName+'.rotateY', 15)88 MayaCmds.setAttr(nodeName+'.translateY', -3.95443)89 nodeName = MayaCmds.group()90 MayaCmds.setAttr(nodeName+'.rotateZ',-90)91 MayaCmds.setAttr(nodeName+'.shearXZ',2.555)92 self.__files.append(util.expandFileName('testAnimLoadWorldSpaceTranslateJob.abc'))93 MayaCmds.AbcExport(j='-fr 1 24 -ws -root %s -file %s' %94 (root, self.__files[-1]))95 # reading test96 MayaCmds.AbcImport(self.__files[-1], mode='open')97 # frame 198 MayaCmds.currentTime(1, update=True)99 self.failUnlessAlmostEqual(0, MayaCmds.getAttr(root+'.translateX'), 3)100 self.failUnlessAlmostEqual(-5.909,101 MayaCmds.getAttr(root+'.translateY'), 3)102 self.failUnlessAlmostEqual(0, MayaCmds.getAttr(root+'.translateZ'), 3)103 self.failUnlessAlmostEqual(68.211, MayaCmds.getAttr(root+'.rotateX'), 3)104 self.failUnlessAlmostEqual(40.351, MayaCmds.getAttr(root+'.rotateY'), 3)105 self.failUnlessAlmostEqual(-90, MayaCmds.getAttr(root+'.rotateZ'), 3)106 self.failUnlessAlmostEqual(0.600, MayaCmds.getAttr(root+'.scaleX'), 3)107 self.failUnlessAlmostEqual(1.905, MayaCmds.getAttr(root+'.scaleY'), 3)108 self.failUnlessAlmostEqual(1.313, MayaCmds.getAttr(root+'.scaleZ'), 3)109 self.failUnlessAlmostEqual(0.539, MayaCmds.getAttr(root+'.shearXY'), 3)110 self.failUnlessAlmostEqual(0.782, MayaCmds.getAttr(root+'.shearXZ'), 3)111 self.failUnlessAlmostEqual(1.051, MayaCmds.getAttr(root+'.shearYZ'), 3)112 # frame 12113 MayaCmds.currentTime(12, update=True)114 self.failUnlessAlmostEqual(0, MayaCmds.getAttr(root+'.translateX'), 3)115 self.failUnlessAlmostEqual(-6.2135,116 MayaCmds.getAttr(root+'.translateY'), 3)117 self.failUnlessAlmostEqual(-0.258819,118 MayaCmds.getAttr(root+'.translateZ'), 3)119 self.failUnlessAlmostEqual(68.211, MayaCmds.getAttr(root+'.rotateX'),120 3)121 self.failUnlessAlmostEqual(40.351, MayaCmds.getAttr(root+'.rotateY'),122 3)123 self.failUnlessAlmostEqual(-90, MayaCmds.getAttr(root+'.rotateZ'), 3)124 self.failUnlessAlmostEqual(0.600, MayaCmds.getAttr(root+'.scaleX'), 3)125 self.failUnlessAlmostEqual(1.905, MayaCmds.getAttr(root+'.scaleY'), 3)126 self.failUnlessAlmostEqual(1.313, MayaCmds.getAttr(root+'.scaleZ'), 3)127 self.failUnlessAlmostEqual(0.539, MayaCmds.getAttr(root+'.shearXY'), 3)128 self.failUnlessAlmostEqual(0.782, MayaCmds.getAttr(root+'.shearXZ'), 3)129 self.failUnlessAlmostEqual(1.051, MayaCmds.getAttr(root+'.shearYZ'), 3)130 # frame 24131 MayaCmds.currentTime(24, update=True)132 self.failUnlessAlmostEqual(0, MayaCmds.getAttr(root+'.translateX'), 3)133 self.failUnlessAlmostEqual(-5.909,134 MayaCmds.getAttr(root+'.translateY'), 3)135 self.failUnlessAlmostEqual(0, MayaCmds.getAttr(root+'.translateZ'), 3)136 self.failUnlessAlmostEqual(68.211, MayaCmds.getAttr(root+'.rotateX'),137 3)138 self.failUnlessAlmostEqual(40.351, MayaCmds.getAttr(root+'.rotateY'),139 3)140 self.failUnlessAlmostEqual(-90, MayaCmds.getAttr(root+'.rotateZ'), 3)141 self.failUnlessAlmostEqual(0.600, MayaCmds.getAttr(root+'.scaleX'), 3)142 self.failUnlessAlmostEqual(1.905, MayaCmds.getAttr(root+'.scaleY'), 3)143 self.failUnlessAlmostEqual(1.313, MayaCmds.getAttr(root+'.scaleZ'), 3)144 self.failUnlessAlmostEqual(0.539, MayaCmds.getAttr(root+'.shearXY'), 3)145 self.failUnlessAlmostEqual(0.782, MayaCmds.getAttr(root+'.shearXZ'), 3)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!