Daryl Lim commited on
Commit
9d3984a
·
1 Parent(s): 0758e3a

test: remove obsolete hint, char count, and button placement tests

Browse files
Files changed (1) hide show
  1. tests/test_app.py +0 -36
tests/test_app.py CHANGED
@@ -178,26 +178,6 @@ def test_demo_has_translate_button(demo):
178
  assert any(b.value == "Translate" for b in buttons), "Expected a 'Translate' button"
179
 
180
 
181
- def _find_ancestor(block, ancestor_type: str):
182
- """Walk up the parent chain to find the nearest ancestor of a given type."""
183
- node = getattr(block, "parent", None)
184
- while node is not None:
185
- if type(node).__name__ == ancestor_type:
186
- return node
187
- node = getattr(node, "parent", None)
188
- return None
189
-
190
-
191
- def test_translate_button_in_input_column(demo):
192
- """Translate button should be in the same column as the input textbox."""
193
- textboxes = [b for b in demo.blocks.values() if type(b).__name__ == "Textbox"]
194
- input_tb = [t for t in textboxes if t.interactive is not False][0]
195
- buttons = [b for b in demo.blocks.values() if type(b).__name__ == "Button" and b.value == "Translate"]
196
- assert len(buttons) == 1
197
- input_column = _find_ancestor(input_tb, "Column")
198
- button_column = _find_ancestor(buttons[0], "Column")
199
- assert input_column is not None, "Input textbox should be inside a Column"
200
- assert input_column is button_column, "Translate button should be in the input column"
201
 
202
 
203
  def test_translate_handlers_wire_text_and_language(demo):
@@ -206,26 +186,10 @@ def test_translate_handlers_wire_text_and_language(demo):
206
  assert len(translate_fns) == 2, f"Expected 2 translate handlers (click + submit), found {len(translate_fns)}"
207
 
208
 
209
- def test_char_count_handler_exists(demo):
210
- """Character count handler should wire input text to the HTML info element."""
211
- char_fns = [
212
- fn
213
- for fn in demo.fns.values()
214
- if [type(i).__name__ for i in fn.inputs] == ["Textbox"] and [type(o).__name__ for o in fn.outputs] == ["HTML"]
215
- ]
216
- assert len(char_fns) == 1, f"Expected 1 char count handler, found {len(char_fns)}"
217
 
218
 
219
- def test_char_count_shows_limit(demo):
220
- """HTML info element should show '0 / 2,000' format."""
221
- html_blocks = [b for b in demo.blocks.values() if type(b).__name__ == "HTML"]
222
- assert any("2,000" in (h.value or "") for h in html_blocks), "Expected '2,000' in an HTML block"
223
 
224
 
225
- def test_shortcut_hint_exists(demo):
226
- """HTML info element should include shortcut hint."""
227
- html_blocks = [b for b in demo.blocks.values() if type(b).__name__ == "HTML"]
228
- assert any("Press Ctrl+Enter to apply" in (h.value or "") for h in html_blocks), "Expected hint in an HTML block"
229
 
230
 
231
  def test_no_title(demo):
 
178
  assert any(b.value == "Translate" for b in buttons), "Expected a 'Translate' button"
179
 
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
 
183
  def test_translate_handlers_wire_text_and_language(demo):
 
186
  assert len(translate_fns) == 2, f"Expected 2 translate handlers (click + submit), found {len(translate_fns)}"
187
 
188
 
 
 
 
 
 
 
 
 
189
 
190
 
 
 
 
 
191
 
192
 
 
 
 
 
193
 
194
 
195
  def test_no_title(demo):