From 27dd532241efbe38f640c923533d8ea91ebabe2e Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 6 Sep 2022 23:53:43 +0200 Subject: Added stub tests to package --- szilagyi/tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 szilagyi/tests.py 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) -- cgit v1.1