]> dreyeck.freedombox.rocks Git - topic-maps.git/blobdiff - scripts/check-report.py
feat(tmdm): merge same-map topic identities and retarget name references
[topic-maps.git] / scripts / check-report.py
index bdcd909b59c52cb31cd3ade812faa4b9c97e81c4..43a1c2d79faaeeba5368f9fe01fb67c9e53e26e2 100644 (file)
@@ -10,15 +10,21 @@ lock = json.loads((root / 'references/corpus-lock.json').read_text())
 assert report['repository'] == lock['repository'] and report['commit'] == lock['commit']
 assert report['qualification'] == lock['draftQualification']
 assert report['counts'] == lock['ctmCounts']
-assert report['implemented'] == dict(ctmParsing=False, tmdmDeserialization=False, cxtmCanonicalization=False)
+slice1 = len(sys.argv) > 2 and sys.argv[2] == '--slice-1'
+assert report['implemented'] == dict(ctmParsing=slice1, tmdmDeserialization=slice1, cxtmCanonicalization=False)
 assert report['countsMatchPin'] is True
 assert report['correspondence'] == dict(ok=True, missingInputs=[], missingBaselines=[], unmatchedBaselines=[], duplicateIDs=[])
 cases = report['cases']
 assert len(cases) == report['counts']['valid'] + report['counts']['invalid']
-assert report['statuses'] == {'pass': 0, 'fail': 0, 'unsupported': 0, 'not-run': len(cases)}
+assert report['statuses'] == {'pass': int(slice1), 'fail': 0, 'unsupported': 0, 'not-run': len(cases)-int(slice1)}
 assert [c['id'] for c in cases] == sorted(c['id'] for c in cases)
 assert len({c['id'] for c in cases}) == len(cases)
-assert all(c['status'] == 'not-run' and c['actualOutcome'] is None and c['diagnostics'] == [] for c in cases)
+untested = [c for c in cases if not (slice1 and c['id'] == 'ctm/invalid/prefix-undefined.ctm')]
+assert all(c['status'] == 'not-run' and c['actualOutcome'] is None and c['diagnostics'] == [] for c in untested)
+if slice1:
+    negative = next(c for c in cases if c['id'] == 'ctm/invalid/prefix-undefined.ctm')
+    assert negative['status'] == 'pass' and negative['actualOutcome'] == 'ctm-rejection'
+    assert len(negative['diagnostics']) == 1 and 'UNDEFINED-PREFIX' in negative['diagnostics'][0]
 assert all(c['documentIRI'] == 'https://ctm-tests.example.invalid/' + lock['commit'] + '/' + c['id'] for c in cases)
 assert sum(c['category'] == 'valid' for c in cases) == report['counts']['valid']
 assert sum(c['category'] == 'invalid' for c in cases) == report['counts']['invalid']
@@ -29,4 +35,4 @@ assert all((root/'vendor/cxtm'/c['expectedCXTM']).is_file() for c in cases if c[
 assert len(report['auxiliaryResources']) == report['counts']['auxiliary']
 assert len(report['baselines']) == report['counts']['baselines']
 assert len(report['infrastructureChecks']) == len(set(report['infrastructureChecks'])) > 0
-print('REPORT-JSON-PASS: deterministic schema, draft qualification, case contracts and zero CTM passes')
+print('REPORT-JSON-PASS: deterministic schema, draft qualification, case contracts and only warranted imported status changes')