Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/build_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function _build_system(
PSY.get_runchecks(sys)
# update_stats!(sys_descriptor, time() - start)
end
PSY.set_units_base_system!(sys, "SYSTEM_BASE")
print_stat ? print_stats(sys_descriptor) : nothing
return sys
end
9 changes: 9 additions & 0 deletions test/test_unit_system.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@testset "build_system returns SYSTEM_BASE" begin
# Matpower systems were previously built in DEVICE_BASE
sys = build_system(MatpowerTestSystems, "matpower_case5_sys"; force_build = true)
@test PSY.get_units_base(sys) == "SYSTEM_BASE"

Copilot AI Mar 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test only exercises the force_build=true path. Since the units-base normalization was added to _build_system after an if/else that also handles deserialization, it would be good to add an assertion for the deserialization path too (e.g., call build_system a second time with force_build=false and re-check the units base).

Suggested change
@test PSY.get_units_base(sys) == "SYSTEM_BASE"
@test PSY.get_units_base(sys) == "SYSTEM_BASE"
# Also test the deserialization path (force_build = false)
sys2 = build_system(MatpowerTestSystems, "matpower_case5_sys"; force_build = false)
@test PSY.get_units_base(sys2) == "SYSTEM_BASE"

Copilot uses AI. Check for mistakes.

# Also test the deserialization path
sys2 = build_system(MatpowerTestSystems, "matpower_case5_sys"; force_build = false)
@test PSY.get_units_base(sys2) == "SYSTEM_BASE"
end
Loading