summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--szilagyi/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/szilagyi/tests.py b/szilagyi/tests.py
new file mode 100644
index 0000000..87b4dd4
--- /dev/null
+++ b/szilagyi/tests.py
@@ -0,0 +1,16 @@
+import unittest
+
+from . import calculate_swi
+
+
+class CalculateSwi(unittest.TestCase):
+ def test_out_of_range(self):
+ for dt, depth in [(20, -10), (-10, 25000), (20, 6e+4), (41, 25000), (41, -10)]:
+ with self.assertRaises(ValueError):
+ calculate_swi(dt, depth)
+
+ def test_between(self):
+ for dt, depth, low, high in [(6.53, 3e+4, 1, 2)]:
+ swi = calculate_swi(dt, depth)
+ self.assertGreater(swi, low)
+ self.assertLess(swi, high)