Skip to content

Commit

Permalink
test: Clean up three tests
Browse files Browse the repository at this point in the history
Removes a print statement, uses random seeds to speed up re-running
tests.
  • Loading branch information
riddell-stan committed Apr 16, 2020
1 parent 9bd2b33 commit bdb9801
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions tests/test_basic_bernoulli.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,4 @@ def test_bernoulli_random_seed_same():

def test_bernoulli_random_seed_different(posterior):
fits = [stan.build(program_code, data=data, random_seed=seed).sample() for seed in (1, 2)]
for i, fit in enumerate(fits):
print(i, fit["theta"].ravel()[:10])
assert not np.allclose(*[fit["theta"] for fit in fits])
2 changes: 1 addition & 1 deletion tests/test_corr_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_corr_matrix_build():

def test_corr_matrix_sample():
"""Sample from a simple model."""
posterior = stan.build(program_code)
posterior = stan.build(program_code, random_seed=1)
fit = posterior.sample(num_chains=2, num_samples=50)
df = fit.to_frame()
assert len(df["Lambda.1.1"]) == 100
2 changes: 1 addition & 1 deletion tests/test_linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

@pytest.fixture(scope="module")
def posterior():
return stan.build(program_code, data=data)
return stan.build(program_code, data=data, random_seed=1)


def test_linear_regression(posterior):
Expand Down

0 comments on commit bdb9801

Please sign in to comment.