Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nodes/test/mocks/chromadb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def get(
items = list(self._storage.items())

# Filter by ids if provided
if ids:
if ids is not None:
items = [(id, data) for id, data in items if id in ids]

count = 0
Expand Down Expand Up @@ -214,7 +214,7 @@ def add(

def delete(self, ids: List[str] = None, where: Optional[Dict] = None):
"""Delete items from the collection."""
if ids:
if ids is not None:
for id in ids:
if id in self._storage:
del self._storage[id]
Expand All @@ -228,7 +228,7 @@ def delete(self, ids: List[str] = None, where: Optional[Dict] = None):

def update(self, ids: List[str] = None, where: Optional[Dict] = None, new_metadata: Dict = None):
"""Update items in the collection."""
if ids:
if ids is not None:
for id in ids:
if id in self._storage and new_metadata:
self._storage[id]['metadata'].update(new_metadata)
Expand Down
8 changes: 4 additions & 4 deletions nodes/test/mocks/psycopg2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _handle_select_query(self, query: str, params: Tuple):

# Apply LIMIT
limit = self._extract_limit(query, params)
if limit:
if limit is not None:
results = results[:limit]

self._results = results
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand All @@ -331,7 +331,7 @@ def _matches_where_params(self, data: Dict, params: List) -> bool:
"""Check if data matches filter parameters."""
# Check isDeleted
is_deleted = data.get('isdeleted', False)
if False in params and is_deleted:
if any(p is False for p in params) and is_deleted:
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion nodes/test/mocks/weaviate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def matches(self, properties: Dict[str, Any]) -> bool:
elif op == 'like':
# Simple wildcard matching
pattern = value.replace('*', '')
results.append(pattern.lower() in str(prop_value).lower() if prop_value else False)
results.append(pattern.lower() in str(prop_value).lower() if prop_value is not None else False)
elif op == 'greater_or_equal':
results.append(prop_value >= value if prop_value is not None else False)
elif op == 'less_or_equal':
Expand Down
Loading