initial commit
This commit is contained in:
50
tests/test_criteria/test_nij.py
Normal file
50
tests/test_criteria/test_nij.py
Normal file
@@ -0,0 +1,50 @@
|
||||
"""Tests for Nij calculation."""
|
||||
|
||||
import pytest
|
||||
|
||||
from impakt.channel.model import DummyInfo
|
||||
from impakt.criteria.nij import NIJ_INTERCEPTS, nij
|
||||
|
||||
|
||||
class TestNij:
|
||||
def test_nij_computation(self, neck_fz_channel, neck_my_channel):
|
||||
result = nij(fz_channel=neck_fz_channel, my_channel=neck_my_channel)
|
||||
assert result.criterion == "Nij"
|
||||
assert result.value > 0
|
||||
assert result.body_region == "Neck"
|
||||
|
||||
def test_nij_with_channels_dict(self, neck_fz_channel, neck_my_channel):
|
||||
result = nij(channels={"fz": neck_fz_channel, "my": neck_my_channel})
|
||||
assert result.value > 0
|
||||
|
||||
def test_nij_mode_detail(self, neck_fz_channel, neck_my_channel):
|
||||
result = nij(fz_channel=neck_fz_channel, my_channel=neck_my_channel)
|
||||
assert "mode" in result.details
|
||||
assert result.details["mode"] in ("NTE", "NTF", "NCE", "NCF")
|
||||
|
||||
def test_nij_with_dummy_info(self, neck_fz_channel, neck_my_channel):
|
||||
dummy = DummyInfo(dummy_type="H3-50M")
|
||||
result = nij(
|
||||
fz_channel=neck_fz_channel,
|
||||
my_channel=neck_my_channel,
|
||||
dummy=dummy,
|
||||
)
|
||||
assert result.value > 0
|
||||
|
||||
def test_nij_different_dummies_give_different_results(self, neck_fz_channel, neck_my_channel):
|
||||
result_50m = nij(
|
||||
fz_channel=neck_fz_channel,
|
||||
my_channel=neck_my_channel,
|
||||
dummy=DummyInfo(dummy_type="H3-50M"),
|
||||
)
|
||||
result_5f = nij(
|
||||
fz_channel=neck_fz_channel,
|
||||
my_channel=neck_my_channel,
|
||||
dummy=DummyInfo(dummy_type="H3-05F"),
|
||||
)
|
||||
# 5th female has lower intercepts, so Nij should be higher
|
||||
assert result_5f.value > result_50m.value
|
||||
|
||||
def test_nij_requires_both_channels(self):
|
||||
with pytest.raises(ValueError, match="required"):
|
||||
nij(fz_channel=None, my_channel=None)
|
||||
Reference in New Issue
Block a user