Skip to content

Commit cb6d218

Browse files
authored
Merge pull request #1170 from stan-dev/snapshots
Test snapshots
2 parents 801b2b4 + 53afd19 commit cb6d218

16 files changed

Lines changed: 663 additions & 90 deletions

tests/testthat/_snaps/fit-gq.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# print() method works after gq
2+
3+
Code
4+
expect_s3_class(fit_gq$print(), "CmdStanGQ")
5+
Output
6+
variable mean median sd mad q5 q95
7+
y_rep[1]
8+
y_rep[2]
9+
y_rep[3]
10+
y_rep[4]
11+
y_rep[5]
12+
y_rep[6]
13+
y_rep[7]
14+
y_rep[8]
15+
y_rep[9]
16+
y_rep[10]
17+
18+
# showing 10 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
19+
20+
---
21+
22+
Code
23+
fit_gq$print(max_rows = 1)
24+
Output
25+
variable mean median sd mad q5 q95
26+
y_rep[1]
27+
28+
# showing 1 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
29+
30+
---
31+
32+
Code
33+
fit_gq$print(NULL, c("mad"))
34+
Output
35+
variable mad
36+
y_rep[1]
37+
y_rep[2]
38+
y_rep[3]
39+
y_rep[4]
40+
y_rep[5]
41+
y_rep[6]
42+
y_rep[7]
43+
y_rep[8]
44+
y_rep[9]
45+
y_rep[10]
46+
47+
# showing 10 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
48+
49+
---
50+
51+
Code
52+
fit_gq$print(max_rows = 2)
53+
Output
54+
variable mean median sd mad q5 q95
55+
y_rep[1]
56+
y_rep[2]
57+
58+
# showing 2 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
59+
60+
---
61+
62+
Code
63+
fit_gq$print(max_rows = 11)
64+
Output
65+
variable mean median sd mad q5 q95
66+
y_rep[1]
67+
y_rep[2]
68+
y_rep[3]
69+
y_rep[4]
70+
y_rep[5]
71+
y_rep[6]
72+
y_rep[7]
73+
y_rep[8]
74+
y_rep[9]
75+
y_rep[10]
76+
sum_y
77+
78+
---
79+
80+
Code
81+
fit_gq$print("y_rep", max_rows = 2)
82+
Output
83+
variable mean median sd mad q5 q95
84+
y_rep[1]
85+
y_rep[2]
86+
87+
# showing 2 of 10 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
88+
89+
---
90+
91+
Code
92+
fit_gq$print("y_rep")
93+
Output
94+
variable mean median sd mad q5 q95
95+
y_rep[1]
96+
y_rep[2]
97+
y_rep[3]
98+
y_rep[4]
99+
y_rep[5]
100+
y_rep[6]
101+
y_rep[7]
102+
y_rep[8]
103+
y_rep[9]
104+
y_rep[10]
105+
106+
---
107+
108+
Code
109+
fit_gq$print(c("y_rep[1]", "sum_y", "y_rep[3]"))
110+
Output
111+
variable mean median sd mad q5 q95
112+
y_rep[1]
113+
sum_y
114+
y_rep[3]
115+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# summary() and print() methods works after laplace
2+
3+
Code
4+
expect_s3_class(fit_laplace$print(), "CmdStanLaplace")
5+
Output
6+
variable mean median sd mad q5 q95
7+
lp__
8+
lp_approx__
9+
alpha
10+
beta[1]
11+
beta[2]
12+
beta[3]
13+
14+
---
15+
16+
Code
17+
fit_laplace$print(max_rows = 1)
18+
Output
19+
variable mean median sd mad q5 q95
20+
lp__
21+
22+
# showing 1 of 6 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
23+

tests/testthat/_snaps/fit-mcmc.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# print() method works after mcmc
2+
3+
Code
4+
expect_s3_class(fit_mcmc$print(), "CmdStanMCMC")
5+
Output
6+
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
7+
lp__
8+
alpha
9+
beta[1]
10+
beta[2]
11+
beta[3]
12+
13+
---
14+
15+
Code
16+
fit_mcmc$print(max_rows = 1)
17+
Output
18+
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
19+
lp__
20+
21+
# showing 1 of 5 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
22+
23+
---
24+
25+
Code
26+
fit_mcmc$print(NULL, c("ess_sd"))
27+
Output
28+
variable ess_sd
29+
lp__
30+
alpha
31+
beta[1]
32+
beta[2]
33+
beta[3]
34+
35+
---
36+
37+
Code
38+
fit$print()
39+
Output
40+
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
41+
lp__
42+
mu
43+
tau
44+
theta_raw[1]
45+
theta_raw[2]
46+
theta_raw[3]
47+
theta_raw[4]
48+
theta_raw[5]
49+
theta_raw[6]
50+
theta_raw[7]
51+
52+
# showing 10 of 19 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
53+
54+
---
55+
56+
Code
57+
fit$print(max_rows = 2)
58+
Output
59+
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
60+
lp__
61+
mu
62+
63+
# showing 2 of 19 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
64+
65+
---
66+
67+
Code
68+
fit$print(max_rows = 19)
69+
Output
70+
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
71+
lp__
72+
mu
73+
tau
74+
theta_raw[1]
75+
theta_raw[2]
76+
theta_raw[3]
77+
theta_raw[4]
78+
theta_raw[5]
79+
theta_raw[6]
80+
theta_raw[7]
81+
theta_raw[8]
82+
theta[1]
83+
theta[2]
84+
theta[3]
85+
theta[4]
86+
theta[5]
87+
theta[6]
88+
theta[7]
89+
theta[8]
90+
91+
---
92+
93+
Code
94+
fit$print("theta", max_rows = 2)
95+
Output
96+
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
97+
theta[1]
98+
theta[2]
99+
100+
# showing 2 of 8 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
101+
102+
---
103+
104+
Code
105+
fit$print("theta")
106+
Output
107+
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
108+
theta[1]
109+
theta[2]
110+
theta[3]
111+
theta[4]
112+
theta[5]
113+
theta[6]
114+
theta[7]
115+
theta[8]
116+
117+
---
118+
119+
Code
120+
fit$print(c("theta[1]", "tau", "mu", "theta_raw[3]"))
121+
Output
122+
variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
123+
theta[1]
124+
tau
125+
mu
126+
theta_raw[3]
127+

tests/testthat/_snaps/fit-mle.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# print() method works after optimization
2+
3+
Code
4+
expect_s3_class(fit_mle$print(), "CmdStanMLE")
5+
Output
6+
variable estimate
7+
lp__
8+
alpha
9+
beta[1]
10+
beta[2]
11+
beta[3]
12+
13+
---
14+
15+
Code
16+
fit_mle$print(max_rows = 1)
17+
Output
18+
variable estimate
19+
lp__
20+
21+
# showing 1 of 5 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
22+

tests/testthat/_snaps/fit-vb.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# print() method works after vb
2+
3+
Code
4+
expect_s3_class(fit_vb$print(), "CmdStanVB")
5+
Output
6+
variable mean median sd mad q5 q95
7+
lp__
8+
lp_approx__
9+
alpha
10+
beta[1]
11+
beta[2]
12+
beta[3]
13+
14+
---
15+
16+
Code
17+
fit_vb$print(max_rows = 1)
18+
Output
19+
variable mean median sd mad q5 q95
20+
lp__
21+
22+
# showing 1 of 6 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
23+
24+
---
25+
26+
Code
27+
fit$print()
28+
Output
29+
variable mean median sd mad q5 q95
30+
lp__
31+
lp_approx__
32+
mu
33+
tau
34+
theta_raw[1]
35+
theta_raw[2]
36+
theta_raw[3]
37+
theta_raw[4]
38+
theta_raw[5]
39+
theta_raw[6]
40+
41+
# showing 10 of 20 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
42+
43+
---
44+
45+
Code
46+
fit$print(max_rows = 20)
47+
Output
48+
variable mean median sd mad q5 q95
49+
lp__
50+
lp_approx__
51+
mu
52+
tau
53+
theta_raw[1]
54+
theta_raw[2]
55+
theta_raw[3]
56+
theta_raw[4]
57+
theta_raw[5]
58+
theta_raw[6]
59+
theta_raw[7]
60+
theta_raw[8]
61+
theta[1]
62+
theta[2]
63+
theta[3]
64+
theta[4]
65+
theta[5]
66+
theta[6]
67+
theta[7]
68+
theta[8]
69+
70+
---
71+
72+
Code
73+
fit$print(c("theta", "tau", "lp__", "lp_approx__"))
74+
Output
75+
variable mean median sd mad q5 q95
76+
theta[1]
77+
theta[2]
78+
theta[3]
79+
theta[4]
80+
theta[5]
81+
theta[6]
82+
theta[7]
83+
theta[8]
84+
tau
85+
lp__
86+
87+
# showing 10 of 11 rows (change via 'max_rows' argument or 'cmdstanr_max_rows' option)
88+

0 commit comments

Comments
 (0)