@@ -211,10 +211,12 @@ end
211
211
),
212
212
)
213
213
@test getlogprior (vi) == lp_a + lp_b
214
- @test_throws " has no field LogLikelihood" getloglikelihood (vi)
215
- @test_throws " has no field LogLikelihood" getlogp (vi)
216
- @test_throws " has no field LogLikelihood" getlogjoint (vi)
217
- @test_throws " has no field NumProduce" get_num_produce (vi)
214
+ # need regex because 1.11 and 1.12 throw different errors (in 1.12 the
215
+ # missing field is surrounded by backticks)
216
+ @test_throws r" has no field `?LogLikelihood" getloglikelihood (vi)
217
+ @test_throws r" has no field `?LogLikelihood" getlogp (vi)
218
+ @test_throws r" has no field `?LogLikelihood" getlogjoint (vi)
219
+ @test_throws r" has no field `?NumProduce" get_num_produce (vi)
218
220
@test begin
219
221
vi = acclogprior!! (vi, 1.0 )
220
222
getlogprior (vi) == lp_a + lp_b + 1.0
@@ -229,20 +231,24 @@ end
229
231
m, DynamicPPL. setaccs!! (deepcopy (vi), (NumProduceAccumulator (),))
230
232
),
231
233
)
232
- @test_throws " has no field LogPrior" getlogprior (vi)
233
- @test_throws " has no field LogLikelihood" getloglikelihood (vi)
234
- @test_throws " has no field LogPrior" getlogp (vi)
235
- @test_throws " has no field LogPrior" getlogjoint (vi)
234
+ # need regex because 1.11 and 1.12 throw different errors (in 1.12 the
235
+ # missing field is surrounded by backticks)
236
+ @test_throws r" has no field `?LogPrior" getlogprior (vi)
237
+ @test_throws r" has no field `?LogLikelihood" getloglikelihood (vi)
238
+ @test_throws r" has no field `?LogPrior" getlogp (vi)
239
+ @test_throws r" has no field `?LogPrior" getlogjoint (vi)
236
240
@test get_num_produce (vi) == 2
237
241
238
242
# Test evaluating without any accumulators.
239
243
vi = last (DynamicPPL. evaluate!! (m, DynamicPPL. setaccs!! (deepcopy (vi), ())))
240
- @test_throws " has no field LogPrior" getlogprior (vi)
241
- @test_throws " has no field LogLikelihood" getloglikelihood (vi)
242
- @test_throws " has no field LogPrior" getlogp (vi)
243
- @test_throws " has no field LogPrior" getlogjoint (vi)
244
- @test_throws " has no field NumProduce" get_num_produce (vi)
245
- @test_throws " has no field NumProduce" reset_num_produce!! (vi)
244
+ # need regex because 1.11 and 1.12 throw different errors (in 1.12 the
245
+ # missing field is surrounded by backticks)
246
+ @test_throws r" has no field `?LogPrior" getlogprior (vi)
247
+ @test_throws r" has no field `?LogLikelihood" getloglikelihood (vi)
248
+ @test_throws r" has no field `?LogPrior" getlogp (vi)
249
+ @test_throws r" has no field `?LogPrior" getlogjoint (vi)
250
+ @test_throws r" has no field `?NumProduce" get_num_produce (vi)
251
+ @test_throws r" has no field `?NumProduce" reset_num_produce!! (vi)
246
252
end
247
253
248
254
@testset " flags" begin
0 commit comments