Skip to content

Commit

Permalink
Fix testS
Browse files Browse the repository at this point in the history
  • Loading branch information
giopaglia committed Nov 25, 2024
1 parent aba2fb2 commit e56a684
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/scalar/conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function parsecondition(
kwargs...
) where {U,FT<:AbstractFeature,C<:ScalarCondition{U,FT}}
if !isnothing(featuretype) && featuretype != FT
throw(ValueError("Cannot parse condition of type $(C) with " *
throw(ArgumentError("Cannot parse condition of type $(C) with " *
"featuretype = $(featuretype). (expr = $(repr(expr)))"))
end
_parsecondition(C, expr; kwargs...)
Expand All @@ -257,7 +257,7 @@ function _parsecondition(
slices = match(r, expr)

if isnothing(slices) || length(slices) != 3
throw(ValueError("Could not parse ScalarCondition from " *
throw(ArgumentError("Could not parse ScalarCondition from " *
"expression $(repr(expr)). Regex slices = $(slices)"))
end

Expand Down Expand Up @@ -650,7 +650,7 @@ function _parsecondition(
# r = Regex("^\\s*(\\S+)\\s*([^\\s\\d]+)\\s*(\\[|\\()\\s*(\\S+)\\s*,\\s*(\\S+)\\s*(\\]|\\))\\s*\$")
slices = match(r, expr)
if isnothing(slices) || length(slices) != 5
throw(ValueError("Could not parse ScalarCondition from " *
throw(ArgumentError("Could not parse ScalarCondition from " *
"expression $(repr(expr)). Regex slices = $(slices)"))
end

Expand Down
18 changes: 9 additions & 9 deletions test/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ C = ScalarCondition
@test_nowarn parsecondition(C, "min[V1] <= 32"; featvaltype = Float64, featuretype = AbstractUnivariateFeature)
@test_nowarn parsecondition(C, "max[V2] <= 435"; featvaltype = Float64, featuretype = AbstractUnivariateFeature)
@test_nowarn parsecondition(C, "minimum[V6] > 250.631"; featvaltype = Float64, featuretype = AbstractUnivariateFeature)
@test_throws AssertionError parsecondition(C, " minimum [V7] > 11.2"; featvaltype = Float64, featuretype = AbstractUnivariateFeature)
@test_throws AssertionError parsecondition(C, "avg [V8] > 63.2 "; featvaltype = Float64, featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, " minimum [V7] > 11.2"; featvaltype = Float64, featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, "avg [V8] > 63.2 "; featvaltype = Float64, featuretype = AbstractUnivariateFeature)
@test_nowarn parsecondition(C, "mean[V9] <= 1.0e100"; featvaltype = Float64, featuretype = AbstractUnivariateFeature)

@test_nowarn parsecondition(C, "max{3] <= 12"; featvaltype = Float64, opening_parenthesis="{", variable_name_prefix = "", featuretype = AbstractUnivariateFeature)
Expand All @@ -46,10 +46,10 @@ C = ScalarCondition
@test_nowarn parsecondition(C, "max[V15] <= 723"; featvaltype = Float64, featuretype = AbstractUnivariateFeature)
@test_nowarn parsecondition(C, "mean[V16] == 54.2"; featvaltype = Float64, featuretype = AbstractUnivariateFeature)

@test_throws ValueError parsecondition(C, "5345.4 < avg [V13] < 32.2 < 12.2"; featuretype = AbstractUnivariateFeature)
@test_throws ValueError parsecondition(C, "avg [V14] < 12.2 <= 6127.2"; featuretype = AbstractUnivariateFeature)
@test_throws ValueError parsecondition(C, "mean189] > 113.2"; featuretype = AbstractUnivariateFeature)
@test_throws ValueError parsecondition(C, "123.4 < avg [V12] > 777.2 "; featuretype = AbstractUnivariateFeature)
@test_throws ValueError parsecondition(C, "mimimum [V17] < 23.2 <= 156.2"; featuretype = AbstractUnivariateFeature)
@test_throws ValueError parsecondition(C, "max[V3} <= 12"; opening_parenthesis="{", featuretype = AbstractUnivariateFeature)
@test_throws ValueError parsecondition(C, "max{18] <= 12"; opening_parenthesis="}", variable_name_prefix = "", featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, "5345.4 < avg [V13] < 32.2 < 12.2"; featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, "avg [V14] < 12.2 <= 6127.2"; featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, "mean189] > 113.2"; featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, "123.4 < avg [V12] > 777.2 "; featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, "mimimum [V17] < 23.2 <= 156.2"; featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, "max[V3} <= 12"; opening_parenthesis="{", featuretype = AbstractUnivariateFeature)
@test_throws ArgumentError parsecondition(C, "max{18] <= 12"; opening_parenthesis="}", variable_name_prefix = "", featuretype = AbstractUnivariateFeature)

0 comments on commit e56a684

Please sign in to comment.