Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit a872387

Browse files
authored
Test for fit.summary() with pars argument
1 parent 555b8a6 commit a872387

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pystan/tests/test_misc_args.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class TestArgs(unittest.TestCase):
1010
@classmethod
1111
def setUpClass(cls):
12-
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
12+
model_code = 'parameters {real x;real y;real z;} model {x ~ normal(0,1);y ~ normal(0,1);z ~ normal(0,1)}'
1313
cls.model = pystan.StanModel(model_code=model_code)
1414

1515
def test_control(self):
@@ -23,3 +23,21 @@ def test_control(self):
2323
model.sampling(control=control_invalid)
2424
with assertRaisesRegex(ValueError, '`metric` must be one of'):
2525
model.sampling(control={'metric': 'lorem-ipsum'})
26+
27+
def test_print_summary(self):
28+
model = self.model
29+
fit = model.sampling(iter=100)
30+
31+
summary_full = fit.summary()
32+
summary_one_par1 = fit.summary(pars='z')
33+
summary_one_par2 = fit.summary(pars=['z'])
34+
summary_pars = fit.summary(pars=['x', 'y'])
35+
36+
assertNotEqual(summary_full, summary_one_par1)
37+
assertNotEqual(summary_full, summary_one_par2)
38+
assertNotEqual(summary_full, summary_pars)
39+
assertNotEqual(summary_one_par1, summary_one_par2)
40+
assertNotEqual(summary_one_par1, summary_pars)
41+
assertNotEqual(summary_one_par2, summary_pars)
42+
43+
assertEqual(summary_one_par1, summary_one_par2)

0 commit comments

Comments
 (0)