summaryrefslogtreecommitdiff
path: root/szilagyi/tests.py
blob: 87b4dd4955048ae710b1c882b14b060becac4fa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)