Skip to content

Commit

Permalink
test: Handle float comparison with Pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Mar 4, 2024
1 parent 64768af commit f5c0371
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Binary file not shown.
15 changes: 8 additions & 7 deletions tests/test_basics.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import fiatlux
import pytest


def a(q):
return 0.1


def f2(x, q):
return 0.
return 0.0


def fl(x, q):
return 0.
return 0.0


def f2lo(x, q):
return 0.
return 0.0


def test_loading():
Expand All @@ -23,7 +24,7 @@ def test_loading():
lux.PlugStructureFunctions(f2, fl, f2lo)
lux.InsertInelasticSplitQ([4.18, 1e100])
pht = lux.EvaluatePhoton(0.1, 1000)
assert pht.elastic == 0.0601621248523242
assert pht.inelastic_pf == 0.01927555943602428
assert pht.msbar_pf == 0.0
assert pht.total == 0.07943768428834848
assert pytest.approx(pht.elastic) == 0.0601621248523242
assert pytest.approx(pht.inelastic_pf) == 0.01927555943602428
assert pytest.approx(pht.msbar_pf) == 0.0
assert pytest.approx(pht.total) == 0.07943768428834848

0 comments on commit f5c0371

Please sign in to comment.