@@ -313,20 +313,23 @@ def test_set_parameter_alias():
313
313
box_vector .put (VectorEntity (name = "Object 4" , vector = [4 , 4 ]))
314
314
box_vector .put (VectorEntity (name = "Object 5" , vector = [5 , 5 ]))
315
315
316
- str_prop : Property = TestEntity .properties [1 ]
317
- qb = box .query (str_prop .equals ("Foo" ).alias ("foo_filter" ))
316
+ str_prop : Property = TestEntity .get_property ("str" )
317
+ int32_prop : Property = TestEntity .get_property ("int32" )
318
+ int64_prop : Property = TestEntity .get_property ("int64" )
318
319
320
+ # Test set parameter alias on string
321
+ qb = box .query (str_prop .equals ("Foo" ).alias ("foo_filter" ))
319
322
query = qb .build ()
323
+
320
324
assert query .find ()[0 ].str == "Foo"
321
325
assert query .count () == 1
322
326
323
327
query .set_parameter_alias_string ("foo_filter" , "FooBar" )
324
-
325
328
assert query .find ()[0 ].str == "FooBar"
326
329
assert query .count () == 1
327
330
328
- int_prop : Property = TestEntity . properties [ 3 ]
329
- qb = box .query (int_prop .greater_than (5 ).alias ("greater_than_filter" ))
331
+ # Test set parameter alias on int64
332
+ qb = box .query (int64_prop .greater_than (5 ).alias ("greater_than_filter" ))
330
333
331
334
query = qb .build ()
332
335
assert query .count () == 1
@@ -336,6 +339,21 @@ def test_set_parameter_alias():
336
339
337
340
assert query .count () == 2
338
341
342
+ # Test set parameter alias on string/int32
343
+ qb = box .query (str_prop .equals ("Foo" ).alias ("str condition" ))
344
+ int32_prop .greater_than (700 ).alias ("int32 condition" ).apply (qb )
345
+ query = qb .build ()
346
+
347
+ assert query .count () == 1
348
+ assert query .find ()[0 ].str == "Foo"
349
+
350
+ query .set_parameter_alias_string ("str condition" , "FooBar" ) # FooBar int32 isn't higher than 700 (49)
351
+ assert query .count () == 0
352
+
353
+ query .set_parameter_alias_int ("int32 condition" , 40 )
354
+ assert query .find ()[0 ].str == "FooBar"
355
+
356
+ # Test set parameter alias on vector
339
357
vector_prop : Property = VectorEntity .get_property ("vector" )
340
358
341
359
query = box_vector .query (vector_prop .nearest_neighbor ([3.4 , 3.4 ], 3 ).alias ("nearest_neighbour_filter" )).build ()
0 commit comments