[Scipy-svn] r6569 - trunk/scipy/constants/tests

scipy-svn@scip... scipy-svn@scip...
Sat Jun 26 23:20:07 CDT 2010


Author: stefan
Date: 2010-06-26 23:20:07 -0500 (Sat, 26 Jun 2010)
New Revision: 6569

Added:
   trunk/scipy/constants/tests/test_constants.py
Log:
ENH: Add basic tests for constants.

Added: trunk/scipy/constants/tests/test_constants.py
===================================================================
--- trunk/scipy/constants/tests/test_constants.py	                        (rev 0)
+++ trunk/scipy/constants/tests/test_constants.py	2010-06-27 04:20:07 UTC (rev 6569)
@@ -0,0 +1,30 @@
+from numpy.testing import run_module_suite, assert_equal
+import scipy.constants as sc
+
+def test_fahrenheit_to_celcius():
+    assert_equal(sc.F2C(32), 0)
+    assert_equal(sc.F2C([32, 32]), [0, 0])
+
+def test_celcius_to_kelvin():
+    assert_equal(sc.C2K([0, 0]), [273.15, 273.15])
+
+def test_kelvin_to_celcius():
+    assert_equal(sc.K2C([0, 0]), [-273.15, -273.15])
+
+def test_fahrenheit_to_kelvin():
+    assert_equal(sc.F2K([32, 32]), [273.15, 273.15])
+
+def test_kelvin_to_fahrenheit():
+    assert_equal(sc.K2F([273.15, 273.15]), [32, 32])
+
+def test_celcius_to_fahrenheit():
+    assert_equal(sc.C2F([0, 0]), [32, 32])
+
+def test_lambda_to_nu():
+    assert_equal(sc.lambda2nu(sc.speed_of_light), 1)
+
+def test_nu_to_lambda():
+    assert_equal(sc.nu2lambda(1), sc.speed_of_light)
+
+if __name__ == "__main__":
+    run_module_suite()



More information about the Scipy-svn mailing list