Skip to content

Commit 622f54d

Browse files
committed
fix more tests
1 parent d1e16a1 commit 622f54d

File tree

7 files changed

+29
-63
lines changed

7 files changed

+29
-63
lines changed

src/Deprecated.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ end
151151

152152
#TODO is Type correct
153153
@deprecate getVariableType(args...) getStateType(args...)
154+
155+
function getVariableTypeName(v::VariableSummary)
156+
Base.depwarn("getVariableTypeName is deprecated.", :getVariableTypeName)
157+
return v.statetype
158+
end
159+
154160
## ================================================================================
155161
## Deprecated in v0.28
156162
##=================================================================================

src/DistributedFactorGraphs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,6 @@ const unstable_functions::Vector{Symbol} = [
359359
:findFactorsBetweenNaive,
360360
:getAgentLabel,
361361
:getGraphLabel,
362-
:getVariableTypeName,
363-
:getVariableType,
364362
:getDescription,
365363
:getAddHistory,
366364
:getSolverParams,
@@ -403,7 +401,7 @@ const unstable_functions::Vector{Symbol} = [
403401
:packState,
404402
:unpack,
405403
:unpackDistribution,
406-
:unpackVariable,
404+
# :unpackVariable,
407405
# :unpackFactor,
408406
:unpackBlob,
409407
:unpackState,
@@ -429,6 +427,8 @@ const unstable_functions::Vector{Symbol} = [
429427
# no set on these
430428

431429
#deprecated in v0.29
430+
:getVariableTypeName,
431+
:getVariableType,
432432
:setTimestamp,
433433
:setMetadata!, # no set, use add merge
434434
:setAgentMetadata!,

src/entities/DFGVariable.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ The default VariableDFG constructor.
216216
#IIF like contruction helper for VariableDFG
217217
function VariableDFG(
218218
label::Symbol,
219-
stateType::Union{T, Type{T}};
219+
statetype::Union{T, Type{T}};
220220
tags::Union{Set{Symbol}, Vector{Symbol}} = Set{Symbol}(),
221221
timestamp::Union{TimeDateZone, ZonedDateTime} = TimeDateZone(now(localzone())),
222222
solvable::Union{Int, Base.RefValue{Int}} = Ref(1),
@@ -299,9 +299,9 @@ $(TYPEDFIELDS)
299299
"""Variable tags, e.g [:POSE, :VARIABLE, and :LANDMARK].
300300
Accessors: [`getTags`](@ref), [`mergeTags!`](@ref), and [`removeTags!`](@ref)"""
301301
tags::Set{Symbol}
302-
"""Symbol for the variableType for the underlying variable.
303-
Accessor: [`getVariableType`](@ref)"""
304-
variableTypeName::Symbol & (json = (name = "variableType",)) # TODO check from StructTypes.names(::Type{VariableSummary}) = ((:variableTypeName, :variableType),)
302+
"""Symbol for the state type for the underlying variable.
303+
Accessor: [`getStateType`](@ref)"""
304+
statetype::Symbol
305305
"""Dictionary of large data associated with this variable.
306306
Accessors: [`addBlobentry!`](@ref), [`getBlobentry`](@ref), [`mergeBlobentry!`](@ref), and [`deleteBlobentry!`](@ref)"""
307307
blobentries::Blobentries

src/services/DFGVariable.jl

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -436,33 +436,10 @@ function emptyMetadata!(dfg::AbstractDFG, label::Symbol)
436436
end
437437

438438
##------------------------------------------------------------------------------
439-
## Data Entries and Blobs
439+
## Blobentries and Blobs
440440
##------------------------------------------------------------------------------
441-
442441
## see DataEntryBlob Folder
443442

444-
##------------------------------------------------------------------------------
445-
## variableTypeName
446-
##------------------------------------------------------------------------------
447-
## getter in VariableSummary only
448-
## can be utility function for others
449-
## TODO this should return the variableType object, or try to. it should be getVariableTypeName for the accessor
450-
## TODO Consider parameter N in variableType for dims, and storing constructor in variableTypeName
451-
## TODO or just not having this function at all
452-
# getVariableType(v::VariableSummary) = v.softypename()
453-
##------------------------------------------------------------------------------
454-
455-
"""
456-
$SIGNATURES
457-
Retrieve the soft type name symbol for a VariableSummary. ie :Point2, Pose2, etc.
458-
"""
459-
getVariableTypeName(v::VariableSummary) = v.variableTypeName::Symbol
460-
461-
function getVariableType(v::VariableSummary)
462-
@warn "Looking for type in `Main`. Only use if `variableType` has only one implementation, ie. Pose2. Otherwise use the full variable."
463-
return getfield(Main, v.variableTypeName)()
464-
end
465-
466443
##==============================================================================
467444
## Layer 2 CRUD and SET
468445
##==============================================================================

test/GraphsDFGSummaryTypes.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
dfg = GraphsDFG{NoSolverParams, VARTYPE, FACTYPE}()
66
function DistributedFactorGraphs.VariableSummary(label::Symbol)
77
return VariableSummary(
8-
nothing,
98
label,
10-
DistributedFactorGraphs.now(localzone()),
9+
TimeDateZone("2025-11-13T15:21:57.474125421+01:00"),
1110
Set{Symbol}(),
1211
:Pose2,
1312
Dict{Symbol, Blobentry}(),
@@ -16,9 +15,8 @@ end
1615

1716
function DistributedFactorGraphs.VariableSummary(label::Symbol, ::State{T}) where {T}
1817
return VariableSummary(
19-
nothing,
2018
label,
21-
DistributedFactorGraphs.now(localzone()),
19+
TimeDateZone("2025-11-13T15:21:57.474125421+01:00"),
2220
Set{Symbol}(),
2321
Symbol(T),
2422
Dict{Symbol, Blobentry}(),
@@ -30,7 +28,7 @@ function DistributedFactorGraphs.VariableSkeleton(label::Symbol, args...)
3028
end
3129

3230
function DistributedFactorGraphs.VariableSkeleton(label::Symbol, ::State{T}) where {T}
33-
return VariableSkeleton(nothing, label, Set{Symbol}())
31+
return VariableSkeleton(label, Set{Symbol}())
3432
end
3533

3634
dfg = GraphsDFG{NoSolverParams, VARTYPE, FACTYPE}()
@@ -105,7 +103,6 @@ end
105103

106104
if VARTYPE == VariableSummary
107105
@test getTimestamp(v1) == v1.timestamp
108-
@test getVariableTypeName(v1) == :Pose2
109106
end
110107
end
111108

test/iifInterfaceTests.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,8 @@ end
404404
# Check all fields are equal for all variables
405405
for v in ls(summaryGraph)
406406
for field in variableFields
407-
if field != :variableTypeName
408-
@test getproperty(getVariable(dfg, v), field) ==
409-
getfield(getVariable(summaryGraph, v), field)
410-
else
411-
# Special case to check the symbol variableType is equal to the full variableType.
412-
@test Symbol(typeof(getVariableType(getVariable(dfg, v)))) ==
413-
getVariableTypeName(getVariable(summaryGraph, v))
414-
end
407+
@test getproperty(getVariable(dfg, v), field) ==
408+
getfield(getVariable(summaryGraph, v), field)
415409
end
416410
end
417411
for f in lsf(summaryGraph)

test/testBlocks.jl

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ TestFunctorInferenceType1() = TestFunctorInferenceType1(TestBelief())
3535
TestFunctorInferenceType2() = TestFunctorInferenceType2(TestBelief())
3636
TestAbstractPrior() = TestAbstractPrior(TestBelief())
3737

38-
struct PackedNothingDistribution <: AbstractPackedBelief
39-
_type::Symbol
40-
function PackedNothingDistribution(; _type::String = "PackedNothingDistribution")
41-
return new(Symbol(_type))
42-
end
43-
end
38+
# struct PackedNothingDistribution <: AbstractPackedBelief
39+
# _type::Symbol
40+
# function PackedNothingDistribution(; _type::String = "PackedNothingDistribution")
41+
# return new(Symbol(_type))
42+
# end
43+
# end
4444

45-
DFG.packDistribution(::Nothing) = PackedNothingDistribution()
46-
DFG.unpackDistribution(::PackedNothingDistribution) = nothing
45+
# DFG.packDistribution(::Nothing) = PackedNothingDistribution()
46+
# DFG.unpackDistribution(::PackedNothingDistribution) = nothing
4747

4848
struct TestCCW{T <: AbstractObservation} <: FactorCache
4949
usrfnc!::T
@@ -1357,16 +1357,8 @@ function Summaries(testDFGAPI)
13571357
# Check all fields are equal for all variables
13581358
for v in ls(summaryGraph)
13591359
for field in variableFields
1360-
if field != :variableTypeName
1361-
@test getproperty(getVariable(dfg, v), field) ==
1362-
getproperty(getVariable(summaryGraph, v), field)
1363-
else
1364-
# Special case to check the symbol variableType is equal to the full variableType.
1365-
@test Symbol(typeof(getVariableType(getVariable(dfg, v)))) ==
1366-
getVariableTypeName(getVariable(summaryGraph, v))
1367-
@test getVariableType(getVariable(dfg, v)) ==
1368-
getVariableType(getVariable(summaryGraph, v))
1369-
end
1360+
@test getproperty(getVariable(dfg, v), field) ==
1361+
getproperty(getVariable(summaryGraph, v), field)
13701362
end
13711363
end
13721364
for f in lsf(summaryGraph)

0 commit comments

Comments
 (0)