From dae8e4f35472854ec9c823dbcf7aeb4cba5db42a Mon Sep 17 00:00:00 2001 From: Philipp Temminghoff Date: Fri, 13 Dec 2024 22:12:00 +0100 Subject: [PATCH] chore: cleanup --- tests/conftest.py | 28 ++++++++-------------------- tests/resources/test_loaders.py | 13 ++++--------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2485879..e598a39 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -43,28 +43,16 @@ def loader_registry() -> ResourceLoaderRegistry: def test_config() -> Config: """Create test configuration with sample data.""" prompt_msg = PromptMessage(role="user", content="Test message") + text = TextResource(content="test content", description="Test resource") + path = "llmling.testing.tools.example_tool" + desc = "Example tool for testing" + cfg = ToolConfig(import_path=path, name="example", description=desc) + prompt = StaticPrompt(name="test-prompt", description="Test", messages=[prompt_msg]) return Config( - version="1.0.0", global_settings=GlobalSettings(), - resources={ - "test-resource": TextResource( - content="test content", description="Test resource" - ), - }, - tools={ - "example": ToolConfig( - import_path="llmling.testing.tools.example_tool", - name="example", - description="Example tool for testing", - ), - }, - prompts={ - "test-prompt": StaticPrompt( - name="test-prompt", - description="Test prompt", - messages=[prompt_msg], - ), - }, + resources={"test-resource": text}, + tools={"example": cfg}, + prompts={"test-prompt": prompt}, ) diff --git a/tests/resources/test_loaders.py b/tests/resources/test_loaders.py index e0be21b..53b8a89 100644 --- a/tests/resources/test_loaders.py +++ b/tests/resources/test_loaders.py @@ -358,15 +358,10 @@ async def test_path_loader_directory_with_processors( (tmp_path / "file2.txt").write_text("test2") # Set up processor - processor_registry.register( - "reverse", - ProcessorConfig(import_path="llmling.testing.processors.reverse_text"), - ) - - resource = PathResource( - path=str(tmp_path), - processors=[ProcessingStep(name="reverse")], - ) + cfg = ProcessorConfig(import_path="llmling.testing.processors.reverse_text") + processor_registry.register("reverse", cfg) + procs = [ProcessingStep(name="reverse")] + resource = PathResource(path=str(tmp_path), processors=procs) loader = PathResourceLoader(LoaderContext(resource=resource, name="test")) files = [ result async for result in loader.load(processor_registry=processor_registry)