Skip to content

Commit 4411cdf

Browse files
committed
test_query: get rid of _get_property() usage #29
1 parent 8a261a2 commit 4411cdf

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

tests/test_query.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,8 @@ def test_basics():
162162
#
163163
assert query.remove() == 1
164164

165-
# NN query and using `get_property`
166-
vector_prop: Property = VectorEntity.vector_euclidean
167-
168-
query = box_vector_entity.query(vector_prop.nearest_neighbor([2.1, 2.1], 2)).build()
165+
# NN query
166+
query = box_vector_entity.query(VectorEntity.vector_euclidean.nearest_neighbor([2.1, 2.1], 2)).build()
169167
assert query.count() == 2
170168
assert query.find_ids() == [2, 3]
171169

@@ -322,7 +320,7 @@ def test_offset_limit():
322320
box.put(TestEntity(str="c"))
323321
assert box.count() == 4
324322

325-
int_prop = TestEntity._get_property("int64")
323+
int_prop = TestEntity.int64
326324

327325
query = box.query(int_prop.equals(0)).build()
328326
assert query.count() == 4
@@ -470,9 +468,9 @@ def test_set_parameter_alias():
470468
box_vector.put(VectorEntity(name="Object 4", vector_euclidean=[4, 4]))
471469
box_vector.put(VectorEntity(name="Object 5", vector_euclidean=[5, 5]))
472470

473-
str_prop: Property = TestEntity._get_property("str")
474-
int32_prop: Property = TestEntity._get_property("int32")
475-
int64_prop: Property = TestEntity._get_property("int64")
471+
str_prop: Property = TestEntity.str
472+
int32_prop: Property = TestEntity.int32
473+
int64_prop: Property = TestEntity.int64
476474

477475
# Test set parameter alias on string
478476
qb = box.query(str_prop.equals("Foo").alias("foo_filter"))
@@ -519,7 +517,7 @@ def test_set_parameter_alias():
519517
assert query.count() == 1
520518

521519
# Test set parameter alias on vector
522-
vector_prop: Property = VectorEntity._get_property("vector_euclidean")
520+
vector_prop: Property = VectorEntity.vector_euclidean
523521

524522
query = box_vector.query(vector_prop.nearest_neighbor([3.4, 3.4], 3).alias("nearest_neighbour_filter")).build()
525523
assert query.count() == 3
@@ -546,10 +544,10 @@ def test_set_parameter_alias_advanced():
546544
box.put(TestEntity(str="Zucchini", bool=False, int64=1234, int32=9))
547545
assert box.count() == 8
548546

549-
str_prop = TestEntity._get_property("str")
550-
bool_prop = TestEntity._get_property("bool")
551-
int32_prop = TestEntity._get_property("int32")
552-
int64_prop = TestEntity._get_property("int64")
547+
str_prop = TestEntity.str
548+
bool_prop = TestEntity.bool
549+
int32_prop = TestEntity.int32
550+
int64_prop = TestEntity.int64
553551

554552
query = box.query(
555553
str_prop.equals("Dummy", case_sensitive=False).alias("str_filter")

0 commit comments

Comments
 (0)