Merge pull request #12506 from dev-starlight/develop
fix, Add UTF-8 encoding to read_text method
This commit is contained in:
@@ -2521,7 +2521,9 @@ def test_api_strategy(botclient, tmp_path, mocker):
|
||||
assert_response(rc)
|
||||
assert rc.json()["strategy"] == CURRENT_TEST_STRATEGY
|
||||
|
||||
data = (Path(__file__).parents[1] / "strategy/strats/strategy_test_v3.py").read_text()
|
||||
data = (Path(__file__).parents[1] / "strategy/strats/strategy_test_v3.py").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
assert rc.json()["code"] == data
|
||||
|
||||
rc = client_get(client, f"{BASE_URI}/strategy/NoStrat")
|
||||
|
||||
@@ -14,6 +14,16 @@ class StrategyTestV2(IStrategy):
|
||||
Please look at the SampleStrategy in the user_data/strategy directory
|
||||
or strategy repository https://github.com/freqtrade/freqtrade-strategies
|
||||
for samples and inspiration.
|
||||
|
||||
---
|
||||
|
||||
Some test asian characters.
|
||||
Ensures that unicode characters are handled correctly when reading strategy files.
|
||||
Otherwise this may break on windows systems.
|
||||
All roughly translate to "hello world".
|
||||
chinese string: "你好世界"
|
||||
korean string: "안녕하세요,세계"
|
||||
japanese string: "こんにちは、世界"
|
||||
"""
|
||||
|
||||
INTERFACE_VERSION = 2
|
||||
|
||||
@@ -23,6 +23,16 @@ class StrategyTestV3(IStrategy):
|
||||
Please look at the SampleStrategy in the user_data/strategy directory
|
||||
or strategy repository https://github.com/freqtrade/freqtrade-strategies
|
||||
for samples and inspiration.
|
||||
|
||||
---
|
||||
|
||||
Some test asian characters.
|
||||
Ensures that unicode characters are handled correctly when reading strategy files.
|
||||
Otherwise this may break on windows systems.
|
||||
All roughly translate to "hello world".
|
||||
chinese string: "你好世界"
|
||||
korean string: "안녕하세요,세계"
|
||||
japanese string: "こんにちは、世界"
|
||||
"""
|
||||
|
||||
INTERFACE_VERSION = 3
|
||||
|
||||
@@ -15,7 +15,7 @@ def test_strategy_updater_start(user_dir, capsys) -> None:
|
||||
tmpdirp = Path(user_dir) / "strategies"
|
||||
tmpdirp.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy(teststrats / "strategy_test_v2.py", tmpdirp)
|
||||
old_code = (teststrats / "strategy_test_v2.py").read_text()
|
||||
old_code = (teststrats / "strategy_test_v2.py").read_text(encoding="utf-8")
|
||||
|
||||
args = ["strategy-updater", "--userdir", str(user_dir), "--strategy-list", "StrategyTestV2"]
|
||||
pargs = get_args(args)
|
||||
@@ -29,7 +29,7 @@ def test_strategy_updater_start(user_dir, capsys) -> None:
|
||||
# updated file exists
|
||||
new_file = tmpdirp / "strategy_test_v2.py"
|
||||
assert new_file.exists()
|
||||
new_code = new_file.read_text()
|
||||
new_code = new_file.read_text(encoding="utf-8")
|
||||
assert "INTERFACE_VERSION = 3" in new_code
|
||||
assert "INTERFACE_VERSION = 2" in old_code
|
||||
captured = capsys.readouterr()
|
||||
|
||||
Reference in New Issue
Block a user