@@ -463,58 +463,72 @@ def test__from_query_filter_pb_unary_filter_unknown_op(self, mock_client):
463463 BooleanExpression ._from_query_filter_pb (wrapped_filter_pb , mock_client )
464464
465465 @pytest .mark .parametrize (
466- "op_enum, value, expected_expr_func" ,
466+ "op_enum, value, expected_expr_func, expects_existance " ,
467467 [
468468 (
469469 query_pb .StructuredQuery .FieldFilter .Operator .LESS_THAN ,
470470 10 ,
471471 Expression .less_than ,
472+ True ,
472473 ),
473474 (
474475 query_pb .StructuredQuery .FieldFilter .Operator .LESS_THAN_OR_EQUAL ,
475476 10 ,
476477 Expression .less_than_or_equal ,
478+ True ,
477479 ),
478480 (
479481 query_pb .StructuredQuery .FieldFilter .Operator .GREATER_THAN ,
480482 10 ,
481483 Expression .greater_than ,
484+ True ,
482485 ),
483486 (
484487 query_pb .StructuredQuery .FieldFilter .Operator .GREATER_THAN_OR_EQUAL ,
485488 10 ,
486489 Expression .greater_than_or_equal ,
490+ True ,
491+ ),
492+ (
493+ query_pb .StructuredQuery .FieldFilter .Operator .EQUAL ,
494+ 10 ,
495+ Expression .equal ,
496+ True ,
487497 ),
488- (query_pb .StructuredQuery .FieldFilter .Operator .EQUAL , 10 , Expression .equal ),
489498 (
490499 query_pb .StructuredQuery .FieldFilter .Operator .NOT_EQUAL ,
491500 10 ,
492501 Expression .not_equal ,
502+ False ,
493503 ),
494504 (
495505 query_pb .StructuredQuery .FieldFilter .Operator .ARRAY_CONTAINS ,
496506 10 ,
497507 Expression .array_contains ,
508+ True ,
498509 ),
499510 (
500511 query_pb .StructuredQuery .FieldFilter .Operator .ARRAY_CONTAINS_ANY ,
501512 [10 , 20 ],
502513 Expression .array_contains_any ,
514+ True ,
503515 ),
504516 (
505517 query_pb .StructuredQuery .FieldFilter .Operator .IN ,
506518 [10 , 20 ],
507519 Expression .equal_any ,
520+ True ,
508521 ),
509522 (
510523 query_pb .StructuredQuery .FieldFilter .Operator .NOT_IN ,
511524 [10 , 20 ],
512525 Expression .not_equal_any ,
526+ False ,
513527 ),
514528 ],
515529 )
516530 def test__from_query_filter_pb_field_filter (
517- self , mock_client , op_enum , value , expected_expr_func
531+ self , mock_client , op_enum , value , expected_expr_func , expects_existance
518532 ):
519533 """
520534 test supported field filters
@@ -536,10 +550,11 @@ def test__from_query_filter_pb_field_filter(
536550 [Constant (e ) for e in value ] if isinstance (value , list ) else Constant (value )
537551 )
538552 expected_condition = expected_expr_func (field_expr , value )
539- # should include existance checks
540- expected = expr .And (field_expr .exists (), expected_condition )
553+ if expects_existance :
554+ # some expressions include extra existance checks
555+ expected_condition = expr .And (field_expr .exists (), expected_condition )
541556
542- assert repr (result ) == repr (expected )
557+ assert repr (result ) == repr (expected_condition )
543558
544559 def test__from_query_filter_pb_field_filter_unknown_op (self , mock_client ):
545560 """
0 commit comments