| """ |
| Gradio UI関連のテスト |
| """ |
| import pytest |
|
|
|
|
| class TestGradioApp: |
| """Gradio UIのテスト""" |
|
|
| def test_import_gradio_app(self): |
| """Gradioアプリがインポートできることを確認""" |
| from src.ui.gradio.app import create_app |
| assert create_app is not None |
|
|
| def test_create_app_returns_blocks(self): |
| """create_appがGradio Blocksを返すことを確認""" |
| import gradio as gr |
| from src.ui.gradio.app import create_app |
|
|
| app = create_app() |
| assert isinstance(app, gr.Blocks) |
|
|
| def test_generate_debris_function_exists(self): |
| """generate_debris関数が存在することを確認""" |
| from src.ui.gradio.app import generate_debris |
| assert callable(generate_debris) |
|
|
| def test_generate_debris_returns_tuple(self): |
| """generate_debris関数がタプルを返すことを確認""" |
| from src.ui.gradio.app import generate_debris |
|
|
| |
| result = generate_debris("gpt2") |
|
|
| |
| assert isinstance(result, tuple) |
| assert len(result) == 3 |
|
|
|
|
| class TestGradioAppModelSelection: |
| """モデル選択のテスト""" |
|
|
| def test_get_model_choices(self): |
| """モデル選択肢が取得できることを確認""" |
| from src.ui.gradio.app import get_model_choices |
|
|
| choices = get_model_choices() |
| assert len(choices) > 0 |
| |
| assert all(isinstance(c, tuple) and len(c) == 2 for c in choices) |
|
|
| def test_model_choices_include_new_models(self): |
| """新モデルが選択肢に含まれることを確認""" |
| from src.ui.gradio.app import get_model_choices |
|
|
| choices = get_model_choices() |
| keys = [c[1] for c in choices] |
|
|
| |
| assert "gpt-oss-20b" in keys |
| assert "pythia-410m" in keys |
| assert "qwen2.5-0.5b" in keys |
|
|