Skip to content

Commit

Permalink
try to improve coverage of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarandon committed Sep 8, 2023
1 parent ae5b294 commit b019375
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/nectarchain/tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,31 @@ def test_stats_merge3():
np.testing.assert_allclose( s.variance, np.array([1,1,1,2,2]) )
np.testing.assert_allclose( s.min, np.array([0,1,2,3,4]) )
np.testing.assert_allclose( s.max, np.array([2,3,4,5,6]) )

def test_stats_shape():
import numpy as np
from nectarchain.utils.stats import Stats, CameraStats, CameraSampleStats

s = Stats()
assert s.shape == (1,)

s = CameraStats()
assert s.shape == (2,1855)

s = CameraSampleStats()
assert s.shape == (2,1855,60)


def test_stats_print():
import numpy as np
from nectarchain.utils.stats import Stats, CameraStats, CameraSampleStats

s = Stats()
s.add(1)
s.add(2)
s.add(3)


assert s.__str__() == 'mean: [2.]\nstd: [1.]\nmin: [1.]\nmax: [3.]\ncount: [3]\nshape: (1,)'
assert s.__repr__() == s.__str__()

0 comments on commit b019375

Please sign in to comment.