diff --git a/nodes/test/mocks/chromadb/__init__.py b/nodes/test/mocks/chromadb/__init__.py index e3260420f..a6255ee81 100644 --- a/nodes/test/mocks/chromadb/__init__.py +++ b/nodes/test/mocks/chromadb/__init__.py @@ -182,7 +182,7 @@ def get( count += 1 # Apply limit - if limit and len(results['ids']) >= limit: + if limit is not None and len(results['ids']) >= limit: break return results diff --git a/nodes/test/mocks/psycopg2/__init__.py b/nodes/test/mocks/psycopg2/__init__.py index 054d64667..2bc1d874e 100644 --- a/nodes/test/mocks/psycopg2/__init__.py +++ b/nodes/test/mocks/psycopg2/__init__.py @@ -182,7 +182,7 @@ def _handle_semantic_search(self, query: str, params: Tuple): query_vector = p.tolist() elif isinstance(p, (list, tuple)) and len(p) > 3: query_vector = list(p) - elif isinstance(p, int) and p < 1000: + elif isinstance(p, int) and not isinstance(p, bool) and p < 1000: limit = p else: filter_params.append(p) @@ -318,7 +318,7 @@ def _extract_limit(self, query: str, params: Tuple) -> Optional[int]: if 'limit' in query.lower() and params: # Last param is often the limit for p in reversed(params): - if isinstance(p, int) and p < 10000: + if isinstance(p, int) and not isinstance(p, bool) and p < 10000: return p return None diff --git a/nodes/test/mocks/weaviate/__init__.py b/nodes/test/mocks/weaviate/__init__.py index 6c6d44d4e..0662bbc92 100644 --- a/nodes/test/mocks/weaviate/__init__.py +++ b/nodes/test/mocks/weaviate/__init__.py @@ -278,7 +278,7 @@ def near_vector( ) # Sort by distance (lower is better for cosine distance) - results.sort(key=lambda x: x.metadata.distance if x.metadata.distance else 1.0) + results.sort(key=lambda x: x.metadata.distance if x.metadata.distance is not None else 1.0) return QueryResult(objects=results[:limit])