From 5925b44abe237987198ab9353a91b9483df80426 Mon Sep 17 00:00:00 2001 From: Ghraven Date: Mon, 25 May 2026 01:21:22 +0800 Subject: [PATCH] fix: use utf-8 for test case json files --- burr/cli/__main__.py | 4 ++-- burr/testing/__init__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/burr/cli/__main__.py b/burr/cli/__main__.py index 5bbc99dd5..8967602d9 100644 --- a/burr/cli/__main__.py +++ b/burr/cli/__main__.py @@ -477,14 +477,14 @@ def create_test_case( if target_file_name: # if it already exists, load it up and append to it if os.path.exists(target_file_name): - with open(target_file_name, "r") as f: + with open(target_file_name, "r", encoding="utf-8") as f: # assumes it's a list of test cases current_testcases = json.load(f) current_testcases.append(tc_json) else: current_testcases = [tc_json] print(f"\nWriting data to file {target_file_name}") - with open(target_file_name, "w") as f: + with open(target_file_name, "w", encoding="utf-8") as f: json.dump(current_testcases, f, indent=2) else: logger.info(json.dumps(tc_json, indent=2)) diff --git a/burr/testing/__init__.py b/burr/testing/__init__.py index f1caa19bf..bd89af77f 100644 --- a/burr/testing/__init__.py +++ b/burr/testing/__init__.py @@ -26,7 +26,7 @@ # and then load it for the test. def load_test_cases(file_name: str) -> tuple: """Load test cases from a json file.""" - with open(file_name, "r") as f: + with open(file_name, "r", encoding="utf-8") as f: json_test_cases = json.load(f) test_cases = [(tc.get("input_state"), tc.get("expected_state")) for tc in json_test_cases] test_ids = [