[e988c2]: / tests / unit / measures / test_disclosure_control.py

Download this file

15 lines (9 with data), 374 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import pytest
from ehrql.measures.disclosure_control import apply_sdc
@pytest.mark.parametrize("i,expected", [(6, 0), (7, 0), (8, 10)])
def test_apply_sdc(i, expected):
assert apply_sdc(i) == expected
@pytest.mark.parametrize("bad_value", [-1, 7.1])
def test_apply_sdc_with_bad_value(bad_value):
with pytest.raises(AssertionError):
apply_sdc(bad_value)