@@ -496,11 +496,11 @@ def test_cos(self):
496496 self .assertEqual (cosv (null ), null )
497497 self .assertEqual (cosv (Vector ('hello' )), null )
498498 self .assertEqual (cosv (Vector ([0 , 0.25 , 0.5 , 0.75 , 1 ])), Vector ([1 , 0 , - 1 , 0 , 1 ]))
499- theta = Vector .range (0.001 , 1 , 0.01 )
499+ theta = Vector .range (0 , 1 , 0.01 )
500500 values = [math .cos (th ) for th in theta * Tau ]
501501 for i in range (len (values )):
502- self .assertEqual (cosv (theta .item (i )), values [i ])
503- self .assertEqual (cosv (theta ), values )
502+ self .assertAlmostEqual (cosv (theta .item (i )), values [i ])
503+ self .assertAllAlmostEqual (cosv (theta ), values )
504504
505505 def test_acos (self ):
506506 self .assertEqual (acosv (null ), null )
@@ -515,11 +515,11 @@ def test_sin(self):
515515 self .assertEqual (sinv (null ), null )
516516 self .assertEqual (sinv (Vector ('hello' )), null )
517517 self .assertEqual (sinv (Vector ([0 , 0.25 , 0.5 , 0.75 , 1 ])), Vector ([0 , 1 , 0 , - 1 , 0 ]))
518- theta = Vector .range (0.001 , 1 , 0.01 )
518+ theta = Vector .range (0 , 1 , 0.01 )
519519 values = [math .sin (th ) for th in theta * Tau ]
520520 for i in range (len (values )):
521- self .assertEqual (sinv (theta .item (i )), values [i ])
522- self .assertEqual (sinv (theta ), values )
521+ self .assertAlmostEqual (sinv (theta .item (i )), values [i ])
522+ self .assertAllAlmostEqual (sinv (theta ), values )
523523
524524 def test_asin (self ):
525525 self .assertEqual (asinv (null ), null )
@@ -574,11 +574,11 @@ def test_polar(self):
574574 self .assertEqual (polar (null ), null )
575575 self .assertEqual (polar (Vector ('hello' )), null )
576576 self .assertEqual (polar (Vector ([0 , 0.25 , 0.5 , 0.75 , 1 ])), Vector ([1 , 0 , 0 , 1 , - 1 , 0 , 0 , - 1 , 1 , 0 ]))
577- theta = Vector .range (0.001 , 1 , 0.01 )
577+ theta = Vector .range (0 , 1 , 0.01 )
578578 values = [(math .cos (th ), math .sin (th )) for th in theta * Tau ]
579579 for i in range (len (values )):
580- self .assertEqual (polar (theta .item (i )), values [i ])
581- self .assertEqual (polar (theta ), Vector .compose (values ))
580+ self .assertAllAlmostEqual (polar (theta .item (i )), values [i ])
581+ self .assertAllAlmostEqual (polar (theta ), Vector .compose (values ))
582582
583583 def test_angle (self ):
584584 self .assertEqual (angle (null ), null )
@@ -607,16 +607,16 @@ def test_quaternion(self):
607607 self .assertEqual (quaternion (Vector ([0 , 1 , 0 ]), Vector (0 )), [1 , 0 , 0 , 0 ])
608608 self .assertEqual (quaternion (Vector ([0 , 0 , 1 ]), Vector (0 )), [1 , 0 , 0 , 0 ])
609609 c , s = math .cos (math .pi * 0.25 ), math .sin (math .pi * 0.25 )
610- self .assertEqual (quaternion (Vector ([1 , 0 , 0 ]), Vector (0.25 )), [c , s , 0 , 0 ])
611- self .assertEqual (quaternion (Vector ([0 , 1 , 0 ]), Vector (0.25 )), [c , 0 , s , 0 ])
612- self .assertEqual (quaternion (Vector ([0 , 0 , 1 ]), Vector (0.25 )), [c , 0 , 0 , s ])
610+ self .assertAllAlmostEqual (quaternion (Vector ([1 , 0 , 0 ]), Vector (0.25 )), [c , s , 0 , 0 ])
611+ self .assertAllAlmostEqual (quaternion (Vector ([0 , 1 , 0 ]), Vector (0.25 )), [c , 0 , s , 0 ])
612+ self .assertAllAlmostEqual (quaternion (Vector ([0 , 0 , 1 ]), Vector (0.25 )), [c , 0 , 0 , s ])
613613 self .assertAllAlmostEqual (quaternion (Vector ([1 , 0 , 0 ]), Vector (0.5 )), [0 , 1 , 0 , 0 ])
614614 self .assertAllAlmostEqual (quaternion (Vector ([0 , 1 , 0 ]), Vector (0.5 )), [0 , 0 , 1 , 0 ])
615615 self .assertAllAlmostEqual (quaternion (Vector ([0 , 0 , 1 ]), Vector (0.5 )), [0 , 0 , 0 , 1 ])
616616 c , s = math .cos (math .pi / 3 ), math .sin (math .pi / 3 )
617- self .assertEqual (quaternion (Vector ([1 , 0 , 0 ]), Vector (1 / 3 )), [c , s , 0 , 0 ])
618- self .assertEqual (quaternion (Vector ([0 , 1 , 0 ]), Vector (1 / 3 )), [c , 0 , s , 0 ])
619- self .assertEqual (quaternion (Vector ([0 , 0 , 1 ]), Vector (1 / 3 )), [c , 0 , 0 , s ])
617+ self .assertAllAlmostEqual (quaternion (Vector ([1 , 0 , 0 ]), Vector (1 / 3 )), [c , s , 0 , 0 ])
618+ self .assertAllAlmostEqual (quaternion (Vector ([0 , 1 , 0 ]), Vector (1 / 3 )), [c , 0 , s , 0 ])
619+ self .assertAllAlmostEqual (quaternion (Vector ([0 , 0 , 1 ]), Vector (1 / 3 )), [c , 0 , 0 , s ])
620620 self .assertAllAlmostEqual (quaternion (Vector ([1 , 0 , 0 ]), Vector (1 )), Vector ([- 1 , 0 , 0 , 0 ]))
621621 self .assertAllAlmostEqual (quaternion (Vector ([0 , 1 , 0 ]), Vector (1 )), Vector ([- 1 , 0 , 0 , 0 ]))
622622 self .assertAllAlmostEqual (quaternion (Vector ([0 , 0 , 1 ]), Vector (1 )), Vector ([- 1 , 0 , 0 , 0 ]))
0 commit comments