Skip to content

Commit

Permalink
Added PostgresTest class [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 5, 2024
1 parent a86b82d commit 4da3b49
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/bit_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative "test_helper"

class BitTest < Minitest::Test
class BitTest < PostgresTest
def test_hamming
create_bit_items
result = Item.find(1).nearest_neighbors(:binary_embedding, distance: "hamming").first(3)
Expand Down
2 changes: 1 addition & 1 deletion test/cube_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative "test_helper"

class CubeTest < Minitest::Test
class CubeTest < PostgresTest
def test_cosine
create_items(CosineItem, :cube_embedding)
result = CosineItem.find(1).nearest_neighbors(:cube_embedding, distance: "cosine").first(3)
Expand Down
2 changes: 1 addition & 1 deletion test/halfvec_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative "test_helper"

class HalfvecTest < Minitest::Test
class HalfvecTest < PostgresTest
def test_cosine
create_items(Item, :half_embedding)
result = Item.find(1).nearest_neighbors(:half_embedding, distance: "cosine").first(3)
Expand Down
2 changes: 1 addition & 1 deletion test/neighbor_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative "test_helper"

class NeighborTest < Minitest::Test
class NeighborTest < PostgresTest
def test_schema
file = Tempfile.new
connection = ActiveRecord::VERSION::STRING.to_f >= 7.2 ? PostgresRecord.connection_pool : PostgresRecord.connection
Expand Down
2 changes: 1 addition & 1 deletion test/sparsevec_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative "test_helper"

class SparsevecTest < Minitest::Test
class SparsevecTest < PostgresTest
def test_cosine
create_items(Item, :sparse_embedding)
result = Item.find(1).nearest_neighbors(:sparse_embedding, distance: "cosine").first(3)
Expand Down
2 changes: 1 addition & 1 deletion test/support/postgresql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Product < PostgresRecord
# ensure has_neighbors does not cause model schema to load
raise "has_neighbors loading model schema early" if Item.send(:schema_loaded?)

class Minitest::Test
class PostgresTest < Minitest::Test
def setup
Item.delete_all
end
Expand Down
2 changes: 1 addition & 1 deletion test/vector_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative "test_helper"

class VectorTest < Minitest::Test
class VectorTest < PostgresTest
def test_cosine
create_items(Item, :embedding)
result = Item.find(1).nearest_neighbors(:embedding, distance: "cosine").first(3)
Expand Down

0 comments on commit 4da3b49

Please sign in to comment.