MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / TestDataPipelineFunctions

Class TestDataPipelineFunctions

tests/unit/test_all_embedders.py:251–292  ·  view source on GitHub ↗

Test data pipeline functions that use embedders.

Source from the content-addressed store, hash-verified

249
250
251class TestDataPipelineFunctions:
252 """Test data pipeline functions that use embedders."""
253
254 def test_count_tokens(self, embedder_type=None):
255 """Test token counting with different embedder types."""
256 from api.data_pipeline import count_tokens
257
258 test_text = "This is a test string for token counting."
259
260 if embedder_type is not None:
261 # Test with specific is_ollama_embedder value
262 token_count = count_tokens(test_text, is_ollama_embedder=embedder_type)
263 assert isinstance(token_count, int), "Token count should be an integer"
264 assert token_count > 0, "Token count should be positive"
265 else:
266 # Test with all values
267 for is_ollama in [None, True, False]:
268 token_count = count_tokens(test_text, is_ollama_embedder=is_ollama)
269 assert isinstance(token_count, int), "Token count should be an integer"
270 assert token_count > 0, "Token count should be positive"
271
272 def test_prepare_data_pipeline(self, is_ollama=None):
273 """Test data pipeline preparation with different embedder types."""
274 from api.data_pipeline import prepare_data_pipeline
275
276 if is_ollama is not None:
277 try:
278 pipeline = prepare_data_pipeline(is_ollama_embedder=is_ollama)
279 assert pipeline is not None, "Data pipeline should be created"
280 assert hasattr(pipeline, '__call__'), "Pipeline should be callable"
281 except Exception as e:
282 # Some configurations might fail if services aren't available
283 logger.warning(f"Pipeline creation failed (might be expected): {e}")
284 else:
285 # Test with all values
286 for is_ollama_val in [None, True, False]:
287 try:
288 pipeline = prepare_data_pipeline(is_ollama_embedder=is_ollama_val)
289 assert pipeline is not None, "Data pipeline should be created"
290 assert hasattr(pipeline, '__call__'), "Pipeline should be callable"
291 except Exception as e:
292 logger.warning(f"Pipeline creation failed for is_ollama={is_ollama_val}: {e}")
293
294
295class TestRAGIntegration:

Callers 1

run_all_testsFunction · 0.85

Calls

no outgoing calls

Tested by 1

run_all_testsFunction · 0.68