Skip to content

Commit

Permalink
Merge pull request #67 from enthought/TST/add_angle_unit_tests
Browse files Browse the repository at this point in the history
Add regression tests for #66 fix.
  • Loading branch information
rkern committed Oct 7, 2018
2 parents 633c9fc + 5a92e2b commit 819cba6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scimath/units/tests/units_test_case.py
Expand Up @@ -439,5 +439,30 @@ def test_convert_str(self):
t1 = convert_str(1, "minute", "second")
self.assertAlmostEqual(t1, 60)

t1 = convert_str(1, "minutes", "second")
self.assertAlmostEqual(t1, 60)


class TestAngleUnits(unittest.TestCase):
def test_convert(self):
t1 = units.convert(60, angle.minutes, angle.degree)
self.assertAlmostEqual(t1, 1)

t1 = units.convert(3600, angle.seconds, angle.degree)
self.assertAlmostEqual(t1, 1)

t1 = units.convert(1, angle.degree, angle.radian)
self.assertAlmostEqual(t1, numpy.pi / 180.)

def test_convert_str(self):
t1 = convert_str(60, "'", "deg")
self.assertAlmostEqual(t1, 1)

t1 = convert_str(3600, '"', "deg")
self.assertAlmostEqual(t1, 1)

t1 = convert_str(1, 'deg', "rad")
self.assertAlmostEqual(t1, numpy.pi / 180.)


# EOF #########################################################################

0 comments on commit 819cba6

Please sign in to comment.