Download code/tests/test_author_extraction.py from PratikBuilds/modelclinic-experiment-001: direct link, hf CLI and curl.
- Browser
- Download file 851 Bytes
-
https://huggingface.co/datasets/PratikBuilds/modelclinic-experiment-001/resolve/main/code/tests/test_author_extraction.py
- Command line
-
hf download hf://datasets/PratikBuilds/modelclinic-experiment-001/code/tests/test_author_extraction.py
-
curl -L -o test_author_extraction.py https://huggingface.co/datasets/PratikBuilds/modelclinic-experiment-001/resolve/main/code/tests/test_author_extraction.py
851 Bytes
| import ast,re,sys,unittest | |
| from pathlib import Path | |
| sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) | |
| from long_protocol import strict_extract | |
| class CompareAuthors(unittest.TestCase): | |
| def test_matches_authors_extraction(self): | |
| tree=ast.parse(Path('research_source/mathqa.py').read_text(encoding='utf8'));names={'answer_text','_box_at','last_boxed','extract'};parts=[x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name in names];module=ast.Module(body=parts,type_ignores=[]);ns={'re':re,'_BOX_FORMS':re.compile(r'\\boxed|\\fbox')};exec(compile(module,'upstream_mathqa.py','exec'),ns) | |
| cases=[r'no box',r'\boxed{2}',r'\boxed{1} </think> \boxed{\frac{1}{2}}',r'\boxed{3} and \boxed{',r'\boxed 9$',r'\fbox{4}',r'\boxed{2} then \fbox{3}'] | |
| for t in cases:self.assertEqual(strict_extract(t),ns['extract'](t)[0],t) | |