-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
75 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import pytest | ||
from babyyoda.histo2D import Histo2D | ||
from babyyoda.test import assert_histo2d | ||
|
||
import babyyoda.grogu as grogu | ||
|
||
|
||
# YODA1 does not support histo2d overflows | ||
pytest.importorskip("yoda", minversion="2.0.0") | ||
|
||
try: | ||
import yoda | ||
|
||
yoda_available = True | ||
# version dependence possible here | ||
except ImportError: | ||
import babyyoda.grogu as yoda | ||
|
||
yoda_available = False | ||
|
||
|
||
# TODO use metafunction fixtures instead fo many pytest.mark | ||
|
||
|
||
def create_histo(backend): | ||
h = Histo2D(10, 0, 10, 10, 0, 10, title="test", backend=backend) | ||
w = 0 | ||
for i in range(-10, 12): | ||
for j in range(-10, 12): | ||
w += 1 | ||
h.fill(i, j, w) | ||
# do we already want to use HISTO1D here? | ||
return h | ||
|
||
|
||
@pytest.mark.parametrize("factory1", [grogu.Histo2D, grogu.Histo2D_v3, yoda.Histo2D]) | ||
@pytest.mark.parametrize("factory2", [grogu.Histo2D, grogu.Histo2D_v3, yoda.Histo2D]) | ||
def test_histos_overflow_equal(factory1, factory2): | ||
h1 = create_histo(factory1) | ||
h2 = create_histo(factory2) | ||
|
||
assert_histo2d(h1, h2, includeFlow=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters