31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
"""Actual collector invocation coverage, separate from documentation contracts."""
|
|
from pathlib import Path
|
|
import importlib.util
|
|
import unittest
|
|
|
|
from harness.tests._support.paths import HARNESS
|
|
|
|
|
|
class ActualCollectorTests(unittest.TestCase):
|
|
def test_actual_collector_calls_synthetic_callback_with_one_page_argument(self):
|
|
import importlib.util
|
|
import inspect
|
|
path = HARNESS / 'agents/spec/skills/gitea-implementation-spec-review/scripts/review_support.py'
|
|
spec = importlib.util.spec_from_file_location('readback_invocation_support', path)
|
|
assert spec is not None and spec.loader is not None
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
calls = []
|
|
|
|
def pages(page):
|
|
calls.append(page)
|
|
return {'items': [{'id': page}], 'total_count': 2, 'has_more': page < 2}
|
|
|
|
inspect.signature(pages).bind(1)
|
|
self.assertEqual(calls, [])
|
|
self.assertEqual(module.collect_pages(pages, 'id', page_size=1), [{'id': 1}, {'id': 2}])
|
|
self.assertEqual(calls, [1, 2])
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|