mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 13:22:12 +00:00
Remove unused imports, `embeddings' variable from text search tests
This commit is contained in:
@@ -3,9 +3,6 @@ import re
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from math import inf
|
from math import inf
|
||||||
|
|
||||||
# External Packages
|
|
||||||
import torch
|
|
||||||
|
|
||||||
# Application Packages
|
# Application Packages
|
||||||
from src.search_filter.date_filter import DateFilter
|
from src.search_filter.date_filter import DateFilter
|
||||||
from src.utils.rawconfig import Entry
|
from src.utils.rawconfig import Entry
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
# External Packages
|
|
||||||
import torch
|
|
||||||
|
|
||||||
# Application Packages
|
# Application Packages
|
||||||
from src.search_filter.file_filter import FileFilter
|
from src.search_filter.file_filter import FileFilter
|
||||||
from src.utils.rawconfig import Entry
|
from src.utils.rawconfig import Entry
|
||||||
@@ -9,7 +6,7 @@ from src.utils.rawconfig import Entry
|
|||||||
def test_no_file_filter():
|
def test_no_file_filter():
|
||||||
# Arrange
|
# Arrange
|
||||||
file_filter = FileFilter()
|
file_filter = FileFilter()
|
||||||
embeddings, entries = arrange_content()
|
entries = arrange_content()
|
||||||
q_with_no_filter = 'head tail'
|
q_with_no_filter = 'head tail'
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
@@ -25,7 +22,7 @@ def test_no_file_filter():
|
|||||||
def test_file_filter_with_non_existent_file():
|
def test_file_filter_with_non_existent_file():
|
||||||
# Arrange
|
# Arrange
|
||||||
file_filter = FileFilter()
|
file_filter = FileFilter()
|
||||||
embeddings, entries = arrange_content()
|
entries = arrange_content()
|
||||||
q_with_no_filter = 'head file:"nonexistent.org" tail'
|
q_with_no_filter = 'head file:"nonexistent.org" tail'
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
@@ -41,7 +38,7 @@ def test_file_filter_with_non_existent_file():
|
|||||||
def test_single_file_filter():
|
def test_single_file_filter():
|
||||||
# Arrange
|
# Arrange
|
||||||
file_filter = FileFilter()
|
file_filter = FileFilter()
|
||||||
embeddings, entries = arrange_content()
|
entries = arrange_content()
|
||||||
q_with_no_filter = 'head file:"file 1.org" tail'
|
q_with_no_filter = 'head file:"file 1.org" tail'
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
@@ -57,7 +54,7 @@ def test_single_file_filter():
|
|||||||
def test_file_filter_with_partial_match():
|
def test_file_filter_with_partial_match():
|
||||||
# Arrange
|
# Arrange
|
||||||
file_filter = FileFilter()
|
file_filter = FileFilter()
|
||||||
embeddings, entries = arrange_content()
|
entries = arrange_content()
|
||||||
q_with_no_filter = 'head file:"1.org" tail'
|
q_with_no_filter = 'head file:"1.org" tail'
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
@@ -73,7 +70,7 @@ def test_file_filter_with_partial_match():
|
|||||||
def test_file_filter_with_regex_match():
|
def test_file_filter_with_regex_match():
|
||||||
# Arrange
|
# Arrange
|
||||||
file_filter = FileFilter()
|
file_filter = FileFilter()
|
||||||
embeddings, entries = arrange_content()
|
entries = arrange_content()
|
||||||
q_with_no_filter = 'head file:"*.org" tail'
|
q_with_no_filter = 'head file:"*.org" tail'
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
@@ -89,7 +86,7 @@ def test_file_filter_with_regex_match():
|
|||||||
def test_multiple_file_filter():
|
def test_multiple_file_filter():
|
||||||
# Arrange
|
# Arrange
|
||||||
file_filter = FileFilter()
|
file_filter = FileFilter()
|
||||||
embeddings, entries = arrange_content()
|
entries = arrange_content()
|
||||||
q_with_no_filter = 'head tail file:"file 1.org" file:"file2.org"'
|
q_with_no_filter = 'head tail file:"file 1.org" file:"file2.org"'
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
@@ -103,7 +100,6 @@ def test_multiple_file_filter():
|
|||||||
|
|
||||||
|
|
||||||
def arrange_content():
|
def arrange_content():
|
||||||
embeddings = torch.randn(4, 10)
|
|
||||||
entries = [
|
entries = [
|
||||||
Entry(compiled='', raw='First Entry', file= 'file 1.org'),
|
Entry(compiled='', raw='First Entry', file= 'file 1.org'),
|
||||||
Entry(compiled='', raw='Second Entry', file= 'file2.org'),
|
Entry(compiled='', raw='Second Entry', file= 'file2.org'),
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
# External Packages
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
# Internal Packages
|
# Internal Packages
|
||||||
from src.utils.state import model
|
from src.utils.state import model
|
||||||
from src.utils.constants import web_directory
|
from src.utils.constants import web_directory
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
# Application Packages
|
# Application Packages
|
||||||
from src.search_filter.word_filter import WordFilter
|
from src.search_filter.word_filter import WordFilter
|
||||||
from src.utils.config import SearchType
|
|
||||||
from src.utils.rawconfig import Entry
|
from src.utils.rawconfig import Entry
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user