import importlib.util,pathlib,unittest p=pathlib.Path(__file__).with_name('benchmark.py');spec=importlib.util.spec_from_file_location('bench',p);b=importlib.util.module_from_spec(spec);spec.loader.exec_module(b) class PreparationTests(unittest.TestCase): def test_exact_count_and_middle_needle(self): case=b.choose_prompt(20000,lambda s:len(s)) self.assertLessEqual(case['counted_tokens'],20000) self.assertGreater(case['counted_tokens'],19800) self.assertEqual(case['text'].count(b.NEEDLE),1) self.assertTrue(.45