diff --git a/src/systems/abstractsystem.jl b/src/systems/abstractsystem.jl index f114bc3fa7..216a83f85f 100644 --- a/src/systems/abstractsystem.jl +++ b/src/systems/abstractsystem.jl @@ -932,10 +932,11 @@ function complete(sys::AbstractSystem; split = true, flatten = true) @set! sys.ps = unique!(vcat(get_ps(sys), collect(newparams))) end if flatten - if sys isa Union{OptimizationSystem, ConstraintsSystem, JumpSystem} - newsys = sys - else + if (eqs = equations(sys)) isa Vector && + any(eq -> eq isa Equation && isconnection(eq.lhs), eqs) newsys = expand_connections(sys) + else + newsys = sys end newsys = ModelingToolkit.flatten(newsys) if has_parent(newsys) && get_parent(sys) === nothing diff --git a/test/runtests.jl b/test/runtests.jl index 5db3308540..c7edbfaaf5 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -19,48 +19,48 @@ end @time begin if GROUP == "All" || GROUP == "InterfaceI" @testset "InterfaceI" begin - # @safetestset "Linear Algebra Test" include("linalg.jl") - # @safetestset "AbstractSystem Test" include("abstractsystem.jl") - # @safetestset "Variable Scope Tests" include("variable_scope.jl") - # @safetestset "Symbolic Parameters Test" include("symbolic_parameters.jl") - # @safetestset "Parsing Test" include("variable_parsing.jl") - # @safetestset "Simplify Test" include("simplify.jl") - # @safetestset "Direct Usage Test" include("direct.jl") - # @safetestset "System Linearity Test" include("linearity.jl") - # @safetestset "Input Output Test" include("input_output_handling.jl") - # @safetestset "Clock Test" include("clock.jl") - # @safetestset "ODESystem Test" include("odesystem.jl") - # @safetestset "Dynamic Quantities Test" include("dq_units.jl") - # @safetestset "Unitful Quantities Test" include("units.jl") - # @safetestset "Mass Matrix Test" include("mass_matrix.jl") - # @safetestset "InitializationSystem Test" include("initializationsystem.jl") - # @safetestset "Guess Propagation" include("guess_propagation.jl") - # @safetestset "Hierarchical Initialization Equations" include("hierarchical_initialization_eqs.jl") - # @safetestset "Reduction Test" include("reduction.jl") - # @safetestset "Split Parameters Test" include("split_parameters.jl") - # @safetestset "StaticArrays Test" include("static_arrays.jl") - # @safetestset "Components Test" include("components.jl") - # @safetestset "Model Parsing Test" include("model_parsing.jl") - # @safetestset "Error Handling" include("error_handling.jl") - # @safetestset "StructuralTransformations" include("structural_transformation/runtests.jl") - # @safetestset "State Selection Test" include("state_selection.jl") - # @safetestset "Symbolic Event Test" include("symbolic_events.jl") - # @safetestset "Stream Connect Test" include("stream_connectors.jl") - # @safetestset "Domain Connect Test" include("domain_connectors.jl") - # @safetestset "Lowering Integration Test" include("lowering_solving.jl") - # @safetestset "Dependency Graph Test" include("dep_graphs.jl") - # @safetestset "Function Registration Test" include("function_registration.jl") - # @safetestset "Precompiled Modules Test" include("precompile_test.jl") - # @safetestset "DAE Jacobians Test" include("dae_jacobian.jl") - # @safetestset "Jacobian Sparsity" include("jacobiansparsity.jl") + @safetestset "Linear Algebra Test" include("linalg.jl") + @safetestset "AbstractSystem Test" include("abstractsystem.jl") + @safetestset "Variable Scope Tests" include("variable_scope.jl") + @safetestset "Symbolic Parameters Test" include("symbolic_parameters.jl") + @safetestset "Parsing Test" include("variable_parsing.jl") + @safetestset "Simplify Test" include("simplify.jl") + @safetestset "Direct Usage Test" include("direct.jl") + @safetestset "System Linearity Test" include("linearity.jl") + @safetestset "Input Output Test" include("input_output_handling.jl") + @safetestset "Clock Test" include("clock.jl") + @safetestset "ODESystem Test" include("odesystem.jl") + @safetestset "Dynamic Quantities Test" include("dq_units.jl") + @safetestset "Unitful Quantities Test" include("units.jl") + @safetestset "Mass Matrix Test" include("mass_matrix.jl") + @safetestset "InitializationSystem Test" include("initializationsystem.jl") + @safetestset "Guess Propagation" include("guess_propagation.jl") + @safetestset "Hierarchical Initialization Equations" include("hierarchical_initialization_eqs.jl") + @safetestset "Reduction Test" include("reduction.jl") + @safetestset "Split Parameters Test" include("split_parameters.jl") + @safetestset "StaticArrays Test" include("static_arrays.jl") + @safetestset "Components Test" include("components.jl") + @safetestset "Model Parsing Test" include("model_parsing.jl") + @safetestset "Error Handling" include("error_handling.jl") + @safetestset "StructuralTransformations" include("structural_transformation/runtests.jl") + @safetestset "State Selection Test" include("state_selection.jl") + @safetestset "Symbolic Event Test" include("symbolic_events.jl") + @safetestset "Stream Connect Test" include("stream_connectors.jl") + @safetestset "Domain Connect Test" include("domain_connectors.jl") + @safetestset "Lowering Integration Test" include("lowering_solving.jl") + @safetestset "Dependency Graph Test" include("dep_graphs.jl") + @safetestset "Function Registration Test" include("function_registration.jl") + @safetestset "Precompiled Modules Test" include("precompile_test.jl") + @safetestset "DAE Jacobians Test" include("dae_jacobian.jl") + @safetestset "Jacobian Sparsity" include("jacobiansparsity.jl") @safetestset "Modelingtoolkitize Test" include("modelingtoolkitize.jl") - # @safetestset "FuncAffect Test" include("funcaffect.jl") - # @safetestset "Constants Test" include("constants.jl") - # @safetestset "Parameter Dependency Test" include("parameter_dependencies.jl") - # @safetestset "Generate Custom Function Test" include("generate_custom_function.jl") - # @safetestset "Initial Values Test" include("initial_values.jl") - # @safetestset "Equation Type Accessors Test" include("equation_type_accessors.jl") - # @safetestset "Equations with complex values" include("complex.jl") + @safetestset "FuncAffect Test" include("funcaffect.jl") + @safetestset "Constants Test" include("constants.jl") + @safetestset "Parameter Dependency Test" include("parameter_dependencies.jl") + @safetestset "Generate Custom Function Test" include("generate_custom_function.jl") + @safetestset "Initial Values Test" include("initial_values.jl") + @safetestset "Equation Type Accessors Test" include("equation_type_accessors.jl") + @safetestset "Equations with complex values" include("complex.jl") end end