mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-14 18:31:08 +08:00
docs: add Japanese translate documents (#1812)
* docs: add Japanese documents (`ja/docs`) * docs: add Japanese documents (`ja/codes`) * docs: add Japanese documents * Remove pythontutor blocks in ja/ * Add an empty at the end of each markdown file. * Add the missing figures (use the English version temporarily). * Add index.md for Japanese version. * Add index.html for Japanese version. * Add missing index.assets * Fix backtracking_algorithm.md for Japanese version. * Add avatar_eltociear.jpg. Fix image links on the Japanese landing page. * Add the Japanese banner. --------- Co-authored-by: krahets <krahets@163.com>
This commit is contained in:
committed by
GitHub
parent
2487a27036
commit
954c45864b
33
ja/codes/python/test_all.py
Normal file
33
ja/codes/python/test_all.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
import glob
|
||||
import subprocess
|
||||
|
||||
env = os.environ.copy()
|
||||
env["PYTHONIOENCODING"] = "utf-8"
|
||||
|
||||
if __name__ == "__main__":
|
||||
# ソースコードファイルを検索
|
||||
src_paths = sorted(glob.glob("ja/codes/python/chapter_*/*.py"))
|
||||
errors = []
|
||||
|
||||
# python コードを実行
|
||||
for src_path in src_paths:
|
||||
process = subprocess.Popen(
|
||||
["python", src_path],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
env=env,
|
||||
encoding='utf-8'
|
||||
)
|
||||
# プロセスの完了を待ち、出力とエラーメッセージを取得
|
||||
stdout, stderr = process.communicate()
|
||||
# 終了ステータスをチェック
|
||||
exit_status = process.returncode
|
||||
if exit_status != 0:
|
||||
errors.append(stderr)
|
||||
|
||||
print(f"{len(src_paths)} ファイルをテストしました")
|
||||
print(f"{len(errors)} ファイルで例外が見つかりました")
|
||||
if len(errors) > 0:
|
||||
raise RuntimeError("\n\n".join(errors))
|
||||
Reference in New Issue
Block a user