Skip to content

Commit 2e0f568

Browse files
committed
Ensure function name is saved to JSON
1 parent 39223ed commit 2e0f568

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ratapi/project.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,12 +956,16 @@ def make_data_dict(item):
956956
elif field == "custom_files":
957957

958958
def make_custom_file_dict(item):
959-
return {
959+
file_dict = {
960960
"name": item.name,
961961
"filename": item.filename,
962962
"language": item.language,
963963
"path": try_relative_to(item.path, filepath.parent),
964964
}
965+
if item.name != item.function_name:
966+
file_dict["function_name"] = item.function_name
967+
968+
return file_dict
965969

966970
json_dict["custom_files"] = [make_custom_file_dict(file) for file in attr]
967971

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6874,7 +6874,7 @@ def r1_monolayer():
68746874
custom_files=ratapi.ClassList(
68756875
ratapi.models.CustomFile(
68766876
name="Model_IIb",
6877-
filename="Model_IIb.m",
6877+
filename="ModelIIb.m",
68786878
function_name="Model_IIb",
68796879
language="matlab",
68806880
path=Path(__file__).parent / "test_data",

0 commit comments

Comments
 (0)