Skip to content

Commit

Permalink
Remove XPASS cases with tighter XFAIL condition (#4)
Browse files Browse the repository at this point in the history
* Remove XPASS cases with tighter XFAIL condition

Only the Lagrange Cu(220) model has a low-energy cut-off and therefore a bug in AbINS, so instead of marking XFAIL at frequency parameter level we check inside the test function.
  • Loading branch information
ajjackson authored Nov 22, 2024
1 parent 32c2939 commit 2f9bfc7
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/integration_tests/test_lagrange.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from enum import Enum, auto

import numpy as np
from numpy.testing import assert_allclose
import pytest
Expand All @@ -23,23 +25,30 @@ def lagrange_abins_plus_rf_abins_resolution_function(lagrange_rf, request):
rf = lagrange_rf.get_resolution_function('AbINS', monochromator=request.param)
return abins, rf

class FreqRange(Enum):
LOW = auto()
HIGH = auto()

@pytest.mark.parametrize(
"frequencies",
"frequencies, label",
[
pytest.param(np.arange(100, 1000, 50), id="high frequencies: 100:1000:50"),
pytest.param(
np.arange(10, 100, 10),
id="low frequencies: 10:100:10",
marks=pytest.mark.xfail(reason="LAGRANGE low frequencies to be fixed in Abins"),
np.arange(100, 1000, 50), FreqRange.HIGH,
id="high frequencies: 100:1000:50",
),
pytest.param(
np.arange(10, 100, 10), FreqRange.LOW, id="low frequencies: 10:100:10"
),
],
)
def test_lagrange_against_abins(
frequencies, lagrange_abins_plus_rf_abins_resolution_function
frequencies, label, lagrange_abins_plus_rf_abins_resolution_function
):
abins, rf = lagrange_abins_plus_rf_abins_resolution_function

if abins.get_setting() == "Cu(220) (Lagrange)" and label == FreqRange.LOW:
pytest.xfail(reason="LAGRANGE low frequencies to be fixed in Abins")

actual = rf(frequencies)
expected = abins.get_sigma(frequencies * MEV_TO_WAVENUMBER) * WAVENUMBER_TO_MEV

Expand Down

0 comments on commit 2f9bfc7

Please sign in to comment.