summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-09-06 23:53:43 +0200
committerAki <please@ignore.pl>2022-09-06 23:53:43 +0200
commit27dd532241efbe38f640c923533d8ea91ebabe2e (patch)
tree7efcdee30146b286b2ec1999c2f713e0a3d4a6d5
parentdb30ddf74c118bc4f35893acfc905187176f0945 (diff)
downloadszilagyi-27dd532241efbe38f640c923533d8ea91ebabe2e.zip
szilagyi-27dd532241efbe38f640c923533d8ea91ebabe2e.tar.gz
szilagyi-27dd532241efbe38f640c923533d8ea91ebabe2e.tar.bz2
Added stub tests to package
-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)