Skip to content
This repository was archived by the owner on Aug 8, 2024. It is now read-only.

Commit 08eb25c

Browse files
committed
test core
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
1 parent 732dead commit 08eb25c

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

sample_scf/tests/test_base.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import astropy.units as u
1212
import numpy as np
1313
import pytest
14+
from astropy.utils.misc import NumpyRNGContext
1415
from numpy.testing import assert_allclose
1516

1617
# LOCAL
@@ -57,11 +58,17 @@ def setup_class(self):
5758
(None, 0, 0.5488135039273248),
5859
(1, 2, 0.43599490214200376),
5960
((3, 1), 4, (0.9670298390136767, 0.5472322491757223, 0.9726843599648843)),
61+
((3, 1), None, (0.9670298390136767, 0.5472322491757223, 0.9726843599648843)),
6062
],
6163
)
6264
def test_rvs(self, size, random, expected):
63-
"""Test :meth:`sample_scf.base.rv_continuous_modrvs.rvs`."""
64-
assert_allclose(self.sampler.rvs(size=size, random_state=random), expected, atol=1e-16)
65+
"""Test :meth:`sample_scf.base.rv_continuous_modrvs.rvs`.
66+
67+
The ``NumpyRNGContext`` is to control the random generator used to make
68+
the RandomState. For ``random != None``, this doesn't matter.
69+
"""
70+
with NumpyRNGContext(4):
71+
assert_allclose(self.sampler.rvs(size=size, random_state=random), expected, atol=1e-16)
6572

6673
# /def
6774

@@ -156,6 +163,12 @@ def test_rvs(self, sampler, id, size, random):
156163

157164
# /def
158165

166+
# ===============================================================
167+
# Time Scaling Tests
168+
169+
# ===============================================================
170+
# Image tests
171+
159172

160173
# /class
161174

sample_scf/tests/test_core.py

-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
##############################################################################
77
# IMPORTS
88

9-
# THIRD PARTY
10-
import pytest
11-
129
# LOCAL
1310
from .test_base import Test_SCFSamplerBase
1411
from sample_scf import core
@@ -18,7 +15,6 @@
1815
##############################################################################
1916

2017

21-
@pytest.mark.skip("TODO!")
2218
class Test_SCFSampler(Test_SCFSamplerBase):
2319
"""Test :class:`sample_scf.core.SCFSample`."""
2420

sample_scf/tests/test_init.py

+8
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ def test_expected_imports():
2222
"""Test can import expected modules and objects."""
2323
# LOCAL
2424
import sample_scf
25+
from sample_scf import core, sample_exact, sample_intrp
2526

2627
assert inspect.ismodule(sample_scf)
28+
assert inspect.ismodule(core)
29+
assert inspect.ismodule(sample_exact)
30+
assert inspect.ismodule(sample_intrp)
31+
32+
assert sample_scf.SCFSampler is core.SCFSampler
33+
assert sample_scf.SCFSamplerExact is sample_exact.SCFSampler
34+
assert sample_scf.SCFSamplerInterp is sample_intrp.SCFSampler
2735

2836

2937
# /def

0 commit comments

Comments
 (0)