From 7e8f095e6b1cd91d0e9ca5b7e344f786021dc931 Mon Sep 17 00:00:00 2001 From: Jean-Francois Baffier Date: Mon, 5 Aug 2024 16:00:29 +0900 Subject: [PATCH] New release (#59) * Fixes for tests * Fix format * Update Project.toml --- Project.toml | 9 ++++----- src/ConstraintDomains.jl | 12 ++++++------ src/general.jl | 4 ++-- test/Aqua.jl | 9 +-------- test/ExplicitImports.jl | 3 +++ test/JET.jl | 3 +++ test/runtests.jl | 9 ++++++++- 7 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 test/ExplicitImports.jl create mode 100644 test/JET.jl diff --git a/Project.toml b/Project.toml index deea278..fce5441 100644 --- a/Project.toml +++ b/Project.toml @@ -1,11 +1,10 @@ name = "ConstraintDomains" uuid = "5800fd60-8556-4464-8d61-84ebf7a0bedb" authors = ["Jean-François Baffier"] -version = "0.3.12" +version = "0.3.13" [deps] ConstraintCommons = "e37357d9-0691-492f-a822-e5ea6a920954" -Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4" Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5" PatternFolds = "c18a7f1d-76ad-4ce4-950d-5419b888513b" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" @@ -13,18 +12,18 @@ TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe" [compat] ConstraintCommons = "0.2" -Dictionaries = "0.4" Intervals = "1" PatternFolds = "0.2" StatsBase = "0.34" -TestItemRunner = "0.2, 1" TestItems = "0.1, 1" julia = "1.8" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7" +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" [targets] -test = ["Aqua", "Test", "TestItemRunner"] +test = ["Aqua", "ExplicitImports", "JET", "Test", "TestItemRunner"] diff --git a/src/ConstraintDomains.jl b/src/ConstraintDomains.jl index 04a608e..efcefb9 100644 --- a/src/ConstraintDomains.jl +++ b/src/ConstraintDomains.jl @@ -1,19 +1,19 @@ module ConstraintDomains # SECTION - Imports -using ConstraintCommons -using Dictionaries -using PatternFolds -using StatsBase -using TestItems +import ConstraintCommons: ConstraintCommons, δ_extrema +# import Dictionaries +import PatternFolds: PatternFolds, Interval, Closed +import StatsBase: sample +import TestItems: @testitem # Exports export AbstractDomain export ContinuousDomain export DiscreteDomain -# export DiscreteSet # not defined export ExploreSettings export RangeDomain +export SetDomain export add! export delete! diff --git a/src/general.jl b/src/general.jl index a63b006..2f30dc1 100644 --- a/src/general.jl +++ b/src/general.jl @@ -13,7 +13,7 @@ Extends `Base.convert` for domains. """ function Base.convert(::Type{Intervals}, d::RangeDomain{T}) where {T<:Real} a, b = extrema(get_domain(d)) - return domain(Float64(a) .. Float64(b)) + return domain(Interval{T,Closed,Closed}(a, b)) end function Base.convert(::Type{RangeDomain}, d::Intervals{T}) where {T<:Real} @@ -23,6 +23,6 @@ function Base.convert(::Type{RangeDomain}, d::Intervals{T}) where {T<:Real} return domain(a:b) end -function Base.convert(::Type{RangeDomain}, d::SetDomain{T}) where {T<:Integer} +function Base.convert(::Type{RangeDomain}, d::SetDomain) return domain(collect(get_domain(d))) end diff --git a/test/Aqua.jl b/test/Aqua.jl index 06b8cb1..6c67b57 100644 --- a/test/Aqua.jl +++ b/test/Aqua.jl @@ -1,8 +1,4 @@ @testset "Aqua.jl" begin - import Aqua - import ConstraintDomains - import Dictionaries - # TODO: Fix the broken tests and remove the `broken = true` flag Aqua.test_all( ConstraintDomains; @@ -20,9 +16,6 @@ end @testset "Dependencies compatibility (no extras)" begin - Aqua.test_deps_compat( - ConstraintDomains; - check_extras = false, # ignore = [:Random] - ) + Aqua.test_deps_compat(ConstraintDomains; check_extras = false) end end diff --git a/test/ExplicitImports.jl b/test/ExplicitImports.jl new file mode 100644 index 0000000..c6c9908 --- /dev/null +++ b/test/ExplicitImports.jl @@ -0,0 +1,3 @@ +@testset "Look for Explicit Imports" begin + @test check_no_implicit_imports(ConstraintDomains) === nothing +end diff --git a/test/JET.jl b/test/JET.jl new file mode 100644 index 0000000..28ceb34 --- /dev/null +++ b/test/JET.jl @@ -0,0 +1,3 @@ +@testset "Code linting (JET.jl)" begin + JET.test_package(ConstraintDomains; target_defined_modules = true) +end diff --git a/test/runtests.jl b/test/runtests.jl index decf9df..6029b07 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,14 @@ +using ConstraintDomains + +using Aqua +using ExplicitImports +using JET using Test using TestItemRunner -@testset "Package tests: ConstraintDomains" begin +@testset "Package tests: ConstraintCommons" begin include("Aqua.jl") + include("ExplicitImports.jl") + include("JET.jl") include("TestItemRunner.jl") end