Skip to content

Commit 2c95ab2

Browse files
authored
Merge pull request #141 from JuliaReach/schillic/ExplicitImports
Use ExplicitImports in tests and fix import issues
2 parents 85405a6 + d78ad7d commit 2c95ab2

File tree

7 files changed

+36
-17
lines changed

7 files changed

+36
-17
lines changed

src/SpaceExParser.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,25 @@ export readsxmodel, writesxmodel
66
Load dependencies
77
=========================================#
88

9-
using HybridSystems, LazySets
109
using DataStructures: OrderedDict
11-
import MathematicalSystems
12-
using MathematicalSystems: AbstractSystem, AbstractContinuousSystem,
13-
LinearContinuousSystem, LinearControlContinuousSystem,
10+
using EzXML: readxml, root, eachelement, nodename, nodecontent
11+
using HybridSystems: AbstractSwitching, AutonomousSwitching, GraphAutomaton,
12+
HybridSystem, add_transition!, assignment, guard, inputdim,
13+
inputset, nmodes, ntransitions, resetmap, source, statedim,
14+
stateset, target, transitions
15+
using LazySets: LazySets, AbstractHyperrectangle, HalfSpace, Hyperplane,
16+
Intersection, LazySet, Singleton, dim, high, isuniversal, low
17+
using MathematicalSystems: MathematicalSystems, AbstractSystem,
18+
AbstractContinuousSystem, LinearContinuousSystem,
19+
LinearControlContinuousSystem,
1420
AffineContinuousSystem,
1521
AffineControlContinuousSystem,
1622
ConstrainedLinearContinuousSystem,
1723
ConstrainedLinearControlContinuousSystem,
1824
ConstrainedLinearControlDiscreteSystem,
1925
ConstrainedAffineContinuousSystem,
2026
ConstrainedAffineControlContinuousSystem
21-
using EzXML: readxml, root, eachelement, nodename, nodecontent
22-
using SymEngine: Basic, subs
27+
using SymEngine: Basic, free_symbols, subs
2328

2429
import Base: convert
2530

src/parse.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const _parse_s = Base.Meta.parse
1+
const _parse_s = Base.Meta.parse # NOTE: this is an internal function
22
const _parse_t = Base.parse
33

44
"""

src/symbolic.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,16 @@ end
208208
# ref_tuple is used for the error message
209209
function _add_invariants!(X, U, invariants, state_variables, input_variables, ref_tuple)
210210
for invi in invariants
211-
if LazySets._ishyperplanar(invi)
211+
if LazySets._ishyperplanar(invi) # NOTE: this is an internal function
212212
set_type = Hyperplane{NUM}
213-
elseif LazySets._ishalfspace(invi)
213+
elseif LazySets._ishalfspace(invi) # NOTE: this is an internal function
214214
set_type = HalfSpace{NUM}
215215
else
216216
loc_or_trans, id = ref_tuple
217217
error_msg_set(loc_or_trans, invi, id)
218218
end
219219

220-
vars = LazySets.free_symbols(invi, set_type)
220+
vars = free_symbols(invi, set_type)
221221
got_state_invariant = all(si in state_variables for si in vars)
222222
got_input_invariant = all(si in input_variables for si in vars)
223223
if got_state_invariant

test/Aqua.jl

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[deps]
22
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3+
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
34
EzXML = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615"
45
HybridSystems = "2207ec0c-686c-5054-b4d2-543502888820"
56
LazySets = "b4f0291d-fe17-52bc-9479-3d1a343d9043"
@@ -8,6 +9,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
89

910
[compat]
1011
Aqua = "0.8.9"
12+
ExplicitImports = "1"
1113
EzXML = "1"
1214
HybridSystems = "0.4"
1315
LazySets = "3, 4, 5"

test/quality_assurance.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using SpaceExParser, Test
2+
import Aqua, ExplicitImports
3+
4+
@testset "ExplicitImports tests" begin
5+
@test isnothing(ExplicitImports.check_all_explicit_imports_are_public(SpaceExParser))
6+
@test isnothing(ExplicitImports.check_all_explicit_imports_via_owners(SpaceExParser))
7+
ignores = (:_ishalfspace, :_ishyperplanar, :parse,)
8+
@test isnothing(ExplicitImports.check_all_qualified_accesses_are_public(SpaceExParser;
9+
ignore=ignores))
10+
@test isnothing(ExplicitImports.check_all_qualified_accesses_via_owners(SpaceExParser))
11+
@test isnothing(ExplicitImports.check_no_implicit_imports(SpaceExParser))
12+
@test isnothing(ExplicitImports.check_no_self_qualified_accesses(SpaceExParser))
13+
@test isnothing(ExplicitImports.check_no_stale_explicit_imports(SpaceExParser))
14+
end
15+
16+
@testset "Aqua tests" begin
17+
Aqua.test_all(SpaceExParser)
18+
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ include("unit_parse.jl")
77
include("unit_affine.jl")
88
end
99

10-
include("Aqua.jl")
10+
include("quality_assurance.jl")

0 commit comments

Comments
 (0)