Download tests/test_retrieval.py from devildasdf/devils-agent: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/devildasdf/devils-agent/resolve/main/tests/test_retrieval.py
- Command line
-
hf download hf://devildasdf/devils-agent/tests/test_retrieval.py
-
curl -L -o test_retrieval.py https://huggingface.co/devildasdf/devils-agent/resolve/main/tests/test_retrieval.py
1.02 kB
| import unittest | |
| from baim.retrieval_audit import bm25 | |
| from baim.mind2web_smoke import normalize_task | |
| class RetrievalTests(unittest.TestCase): | |
| def test_broad_candidates_keep_tabs_without_allowing_sensitive_controls(self): | |
| rows=[dict(role='tab',name='Account'),dict(role='generic',name='Account',sensitive=True), | |
| dict(role='button',name='Other',enabled=False)] | |
| self.assertEqual(bm25('Account',rows),[0]) | |
| def test_history_excludes_current_and_future_actions(self): | |
| candidate=dict(tag='button',attributes='{}',backend_node_id='1') | |
| step=dict(pos_candidates=[candidate],neg_candidates=[],cleaned_html='<button backend_node_id="1">A</button>', | |
| action_uid='a',operation=dict(op='CLICK')) | |
| task=dict(confirmed_task='Goal',action_reprs=['previous','current'],actions=[step,{**step,'action_uid':'b'}]) | |
| rows=list(normalize_task(task)) | |
| self.assertEqual(rows[0]['history'],[]) | |
| self.assertEqual(rows[1]['history'],['previous']) | |