Skip to content

Commit 35b9888

Browse files
committed
fix tests and processing of supertypes
1 parent 4737fe4 commit 35b9888

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/utils_GUI/GUI_utils.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,7 @@ function update_descriptive_names!(gui::GUI)
634634
# apply inheritances for fetching descriptive names
635635
# create a dictionary were the keys are all the types defined in emx_packages and the values are the types they inherit from
636636
emx_supertypes_dict = get_supertypes(emx_packages)
637-
638637
inherit_descriptive_names_from_supertypes!(descriptive_names, emx_supertypes_dict)
639-
640638
for package emx_packages
641639
package_path::Union{String,Nothing} = dirname(dirname(Base.find_package(package)))
642640
if !isnothing(package_path)

src/utils_gen/utils.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,14 @@ function inherit_descriptive_names_from_supertypes!(descriptive_names, emx_super
515515
for fname emx_type_fieldnames
516516
for emx_supertype emx_supertypes[2:end] # skip first element as it is the type itself
517517
#check if the supertype has an entry in descriptive names for fname
518-
if haskey(descriptive_names[:structures], Symbol(emx_supertype)) &&
518+
# Extract only what is after the dot in emx_supertype, if any
519+
supertype_str = string(emx_supertype)
520+
supertype_key =
521+
occursin(r"\.", supertype_str) ?
522+
match(r"\.([^.]+)$", supertype_str).captures[1] : supertype_str
523+
if haskey(descriptive_names[:structures], Symbol(supertype_key)) &&
519524
haskey(
520-
descriptive_names[:structures][Symbol(emx_supertype)],
525+
descriptive_names[:structures][Symbol(supertype_key)],
521526
Symbol(fname),
522527
)
523528
# if so, and if the emx_type does not have an entry for fname, copy it
@@ -531,7 +536,7 @@ function inherit_descriptive_names_from_supertypes!(descriptive_names, emx_super
531536
Dict{Symbol,Any}()
532537
end
533538
descriptive_names[:structures][Symbol(emx_type)][Symbol(fname)] =
534-
descriptive_names[:structures][Symbol(emx_supertype)][Symbol(
539+
descriptive_names[:structures][Symbol(supertype_key)][Symbol(
535540
fname,
536541
)]
537542
end

test/test_interactivity.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ pin_plot_button = get_button(gui, :pin_plot)
107107
@test :RefNetworkNode keys(descriptive_names_raw[:structures])
108108

109109
descriptive_names = EMGUI.get_var(gui2, :descriptive_names)
110-
@test :Node keys(descriptive_names[:structures])
111110
@test descriptive_names[:structures][:StorCapOpexFixed][:opex_fixed] == str1
112111
@test descriptive_names[:structures][:RefNetworkNode][:opex_fixed] == str1
113112
EMGUI.close(gui2)

0 commit comments

Comments
 (0)