test saturation errors

This commit is contained in:
Roman Zeyde
2014-08-24 19:00:41 +03:00
parent 3ce39f3918
commit d13069d7d9

View File

@@ -51,3 +51,12 @@ def test_dumps_loads():
x = np.array([.1, .4, .2, .6, .3, .5])
y = common.loads(common.dumps(x))
assert all(x == y)
def test_saturation():
x = np.array([1, -1, 1, -1]) * 1.01
try:
common.check_saturation(x)
assert False
except common.SaturationError as e:
assert e.args == (1.01,)