Skip to content

Commit

Permalink
Add test for the extend array function
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumit112192 committed Jul 31, 2024
1 parent 2d0a44e commit 0d6dcec
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tardis/transport/montecarlo/tests/test_rpacket_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from tardis.transport.montecarlo.r_packet import InteractionType
from tardis.transport.montecarlo.packet_trackers import (
RPacketTracker,
rpacket_trackers_to_dataframe,
)

Expand Down Expand Up @@ -102,6 +103,17 @@ def nu_rpacket_tracker(rpacket_tracker):
return nu


def test_extend_array():
rpacket_tracker = RPacketTracker(10)
array = np.array([1, 2, 3, 4, 5], dtype=np.int64)

new_array = rpacket_tracker.extend_array(array, array.size)

assert new_array.size == array.size * rpacket_tracker.extend_factor
assert new_array.dtype == array.dtype
npt.assert_allclose(array, new_array[: array.size])


@pytest.mark.parametrize(
"expected,obtained",
[
Expand Down

0 comments on commit 0d6dcec

Please sign in to comment.