Skip to content

Commit

Permalink
Added test for type
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Dec 11, 2023
1 parent cb186c4 commit fa294f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/neighbor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@ def test_neighbor_attributes
assert_equal Item.neighbor_attributes.keys, [:embedding, :neighbor_vector]
end

def test_type
if vector?
Item.create!(factors: "[1,2,3]")
assert_equal "[1,2,3]", Item.last.factors
else
Item.create!(factors: "(1,2,3)")
assert_equal "(1, 2, 3)", Item.last.factors
end
end

def create_items(cls, attribute = :embedding)
vectors = [
[1, 1, 1],
Expand Down
1 change: 1 addition & 0 deletions test/support/cube.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
create_table :items, force: true do |t|
t.cube :embedding
t.cube :neighbor_vector
t.cube :factors
end
end

Expand Down
1 change: 1 addition & 0 deletions test/support/vector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
create_table :items, force: true do |t|
t.vector :embedding, limit: 3
t.vector :neighbor_vector, limit: 3
t.vector :factors, limit: 3
end
end

Expand Down

0 comments on commit fa294f4

Please sign in to comment.