Daryl Lim Claude Opus 4.6 (1M context) commited on
Commit
e71be84
·
1 Parent(s): 522c501

test: add button wiring test and remove stale comments

Browse files

Add test verifying translate button only wires text and language inputs.
Remove leftover task section comments from previous implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. tests/test_app.py +8 -6
tests/test_app.py CHANGED
@@ -35,9 +35,6 @@ def test_translate_accepts_generation_params():
35
  assert "temperature" in params
36
 
37
 
38
- # --- Task 1: Signature default + device tests ---
39
-
40
-
41
  def test_translate_signature_defaults():
42
  """translate() should have correct default values for generation parameters."""
43
  import inspect
@@ -122,6 +119,14 @@ def test_demo_has_translate_button(demo):
122
  assert any(b.value == "Translate" for b in buttons), "Expected a 'Translate' button"
123
 
124
 
 
 
 
 
 
 
 
 
125
  # --- Slow tests (require CUDA + model download) ---
126
 
127
  gpu_available = torch.cuda.is_available()
@@ -174,9 +179,6 @@ def test_translate_returns_string(loaded_app):
174
  assert len(result) > 0
175
 
176
 
177
- # --- Task 6: Slow tests for non-default params ---
178
-
179
-
180
  @pytest.mark.slow
181
  @pytest.mark.skipif(not gpu_available, reason="Requires CUDA")
182
  def test_translate_with_beam_search(loaded_app):
 
35
  assert "temperature" in params
36
 
37
 
 
 
 
38
  def test_translate_signature_defaults():
39
  """translate() should have correct default values for generation parameters."""
40
  import inspect
 
119
  assert any(b.value == "Translate" for b in buttons), "Expected a 'Translate' button"
120
 
121
 
122
+ def test_translate_button_wires_only_text_and_language(demo):
123
+ """Translate button should only wire input text and target language (no sliders)."""
124
+ assert len(demo.fns) == 1, f"Expected 1 event handler, found {len(demo.fns)}"
125
+ fn = list(demo.fns.values())[0]
126
+ input_types = [type(i).__name__ for i in fn.inputs]
127
+ assert input_types == ["Textbox", "Dropdown"], f"Expected [Textbox, Dropdown], got {input_types}"
128
+
129
+
130
  # --- Slow tests (require CUDA + model download) ---
131
 
132
  gpu_available = torch.cuda.is_available()
 
179
  assert len(result) > 0
180
 
181
 
 
 
 
182
  @pytest.mark.slow
183
  @pytest.mark.skipif(not gpu_available, reason="Requires CUDA")
184
  def test_translate_with_beam_search(loaded_app):