OrderedDict instead of dict

This commit is contained in:
2026-04-14 17:57:04 +08:00
parent caf3b423af
commit 675d0a7207

View File

@@ -23,6 +23,7 @@ import json
import re import re
import argparse import argparse
from pathlib import Path from pathlib import Path
from collections import OrderedDict
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__)) SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
sys.path.append(SCRIPT_PATH) sys.path.append(SCRIPT_PATH)
@@ -67,7 +68,7 @@ def suite_path(suite):
try: try:
with open(suite_json, "r") as f: with open(suite_json, "r") as f:
suite_data = json.loads(f.read()) suite_data = json.loads(f.read(), object_pairs_hook=OrderedDict)
if suite_data["path"] is None: if suite_data["path"] is None:
mugen_log.logging("error", "json文件:%s中没有path值." % suite_json) mugen_log.logging("error", "json文件:%s中没有path值." % suite_json)
sys.exit(1) sys.exit(1)
@@ -109,7 +110,7 @@ def suite_cases(suite):
try: try:
with open(suite_json, "r") as f: with open(suite_json, "r") as f:
suite_data = json.loads(f.read()) suite_data = json.loads(f.read(), object_pairs_hook=OrderedDict)
if suite_data["cases"] is None: if suite_data["cases"] is None:
mugen_log.logging("error", "json文件:%s中没有cases值." % suite_json) mugen_log.logging("error", "json文件:%s中没有cases值." % suite_json)
sys.exit(1) sys.exit(1)