Conversation
…uantEcon.LQ` with `LQ`
…ngth, and full-path check - change norm check to element-wise max abs error check - change atol from 1e-5 to 1e-4 to avoid test failure due to numerical precision issues
…ministic optimal growth"
There was a problem hiding this comment.
Pull request overview
This PR fixes and cleans up existing tests in test/test_cdp.jl and test/runtests.jl. It addresses namespace pollution from using QuantEcon inside a @testset block, removes dead code, replaces hardcoded values with named variables, improves simulation path assertions, and wraps inner test loops in labeled @testset blocks for better failure diagnostics.
Changes:
- Move
LQimport toruntests.jl's top-levelusing QuantEconline and remove the innerusing QuantEconfrom the "LQ control" testset to avoid namespace pollution - Enhance simulation tests: add checks for initial value and path length, replace single-endpoint check with full-path max absolute error check, and relax
atolfrom1e-5to1e-4to account for interpolation error accumulation - Clean up dead code (unused
sigma, bares_star, x_starexpression) and replace hardcoded3withn_shocksvariable; wrap inner loop body in labeled@testsetblocks
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/runtests.jl | Add LQ to the explicit import list from QuantEcon |
| test/test_cdp.jl | Remove inner using QuantEcon, use bare LQ(...), add @testset labels, improve simulation assertions, remove dead code, use named variables |
You can also share your feedback on Copilot code review. Take the survey.
…replace `QuantEcon.LQ` with `LQ`" This reverts commit ea92243.
There was a problem hiding this comment.
@mnshkw I made a few changes at https://github.com/QuantEcon/ContinuousDPs.jl/tree/mnshkw-test/fix-existing-tests
Merge this branch into yours.
(See QuantEcon/QuantEcon.jl#229)
Summary
test/cdp.jlandtest/runtests.jl.Changes
test/runtests.jlea92243:LQto the import list fromQuantEconexplicitlytest/test_cdp.jlea92243:using QuantEconfrom inside the@testsetblock due to namespace pollutionQUantEcon.LQ(...)withLQ(...)109efdb:s_starandx_star(dead code), unused variablesigma = 0.1, and replace hardcoded number to already-defined variable9b24891:isapproxcheck with a full-path element-wise max absolute error check usingmaximum(abs, ...) <= atolatolfrom1e-5to1e-4to account for interpolation error accumulated insimulate1.68e-5, which exceeds1e-5but is well within1e-41e-4provides a safety margin while remaining a meaningful numerical bound4bbfe33:@testset "Test $method with $label basis"so that failures clearly identify which bases x method combination failedTest Results
All tests are pass successfully (
Pkg.test()passes locally).Notes for Reviewers
All codes and documentation are written with assistance by LLMs
cc: @oyamad
Could you please review this PR? Thank you.