File size: 2,812 Bytes
a71b0b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3ce9462
a71b0b0
 
 
 
3ce9462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""Annotation cohorts add acceptance scopes without changing the released population."""
from pathlib import Path
import json
import unittest
from test_review_scope import suite_dirs

ROOT = Path(__file__).resolve().parents[1]

class ContentScopesTests(unittest.TestCase):
    def test_annotations_reuse_population_and_preserve_both_scopes(self):
        tasks = json.loads((ROOT/'definitions/evaluation/content-scopes-530/tasks.json').read_text())['cases']
        population = json.loads((ROOT/'definitions/populations/primary-content-20261103.json').read_text())
        self.assertEqual(len(tasks), 530)
        self.assertEqual({c['id'] for c in tasks}, {c['suite']+'--'+c['id'] for c in population['cases']})
        for task in tasks:
            self.assertEqual(set(task['content_scopes']) - {'version'}, {'main', 'full'})
        self.assertNotIn('content-scopes-530', suite_dirs())
        self.assertEqual(set(suite_dirs()), set(population['frozen_task_bindings']))

    def test_annotation_registry_does_not_expand_edition(self):
        manifest = json.loads((ROOT/'manifest.json').read_text())
        self.assertEqual(manifest['edition']['task_count'], 530)
        registry = json.loads((ROOT/'definitions/registry.json').read_text())
        entry = next(s for s in registry['suites'] if s['id']=='content-scopes-530')
        self.assertEqual(entry['kind'], 'annotation_cohort')
        self.assertEqual(entry['source_population'], 'primary-content-20261103')


class EditionTests(unittest.TestCase):
    def test_edition_selects_exactly_the_population_cases(self):
        manifest = json.loads((ROOT/'manifest.json').read_text())
        population = json.loads((ROOT/'definitions/populations/primary-content-20261103.json').read_text())
        names = [c['name'] for c in manifest['edition']['configurations']]
        self.assertNotIn('dynamic-examples', names)
        self.assertNotIn('challenge-examples', names)
        selected = set()
        for name in names:
            for line in (ROOT/'data'/(name+'.jsonl')).read_text().splitlines():
                row = json.loads(line)
                selected.add((row['source_suite'], row['id']))
        self.assertEqual(selected, {(c['suite'], c['id']) for c in population['cases']})

    def test_challenge_set_is_published_outside_the_edition(self):
        rows = [json.loads(l) for l in (ROOT/'data/challenge-examples.jsonl').read_text().splitlines()]
        population = json.loads((ROOT/'definitions/populations/primary-content-20261103.json').read_text())
        excluded = {(c['suite'], c['id']) for c in population['excluded']}
        self.assertEqual(len(rows), 10)
        self.assertTrue({(r['source_suite'], r['id']) for r in rows} <= excluded)
        self.assertFalse((ROOT/'data/dynamic-examples.jsonl').exists())