Skip to content

Commit d2d4cfe

Browse files
committed
removed unneded expressions
1 parent e0f5275 commit d2d4cfe

File tree

3 files changed

+1
-105
lines changed

3 files changed

+1
-105
lines changed

packages/google-cloud-firestore/google/cloud/firestore_v1/pipeline_expressions.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,35 +1176,6 @@ def storage_size(self) -> "Expression":
11761176
"""
11771177
return FunctionExpression("storage_size", [self])
11781178

1179-
@expose_as_static
1180-
def namespace(self) -> "Expression":
1181-
"""Extracts the namespace from a document reference.
1182-
1183-
Example:
1184-
>>> Field.of("__path__").namespace()
1185-
1186-
Returns:
1187-
A new `Expression` representing the namespace extraction.
1188-
"""
1189-
return FunctionExpression("namespace", [self])
1190-
1191-
@expose_as_static
1192-
def has_ancestor(self, ancestor: Expression | CONSTANT_TYPE) -> "BooleanExpression":
1193-
"""Checks if the current document has the specified ancestor.
1194-
1195-
Example:
1196-
>>> Field.of("__path__").has_ancestor("projects/my-project/databases/(default)/documents/users/user1")
1197-
1198-
Args:
1199-
ancestor: The DocumentReference of the potential ancestor.
1200-
1201-
Returns:
1202-
A new `BooleanExpression` representing the has_ancestor check.
1203-
"""
1204-
return BooleanExpression(
1205-
"has_ancestor", [self, self._cast_to_expr_or_convert_to_constant(ancestor)]
1206-
)
1207-
12081179
@expose_as_static
12091180
def reference_slice(
12101181
self, start: int | Expression, end: int | Expression | None = None

packages/google-cloud-firestore/tests/system/pipeline_e2e/general.yaml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -848,62 +848,6 @@ tests:
848848
- fieldReferenceValue: __path__
849849
name: storage_size
850850
name: select
851-
- description: testNamespace
852-
pipeline:
853-
- Collection: books
854-
- Limit: 1
855-
- Select:
856-
- AliasedExpression:
857-
- FunctionExpression.namespace:
858-
- Field: __path__
859-
- res
860-
assert_proto:
861-
pipeline:
862-
stages:
863-
- args:
864-
- referenceValue: /books
865-
name: collection
866-
- args:
867-
- integerValue: '1'
868-
name: limit
869-
- args:
870-
- mapValue:
871-
fields:
872-
res:
873-
functionValue:
874-
args:
875-
- fieldReferenceValue: __path__
876-
name: namespace
877-
name: select
878-
- description: testHasAncestor
879-
pipeline:
880-
- Collection: books
881-
- Limit: 1
882-
- Select:
883-
- AliasedExpression:
884-
- FunctionExpression.has_ancestor:
885-
- Field: __path__
886-
- Constant: "projects/test/databases/(default)/documents"
887-
- res
888-
assert_proto:
889-
pipeline:
890-
stages:
891-
- args:
892-
- referenceValue: /books
893-
name: collection
894-
- args:
895-
- integerValue: '1'
896-
name: limit
897-
- args:
898-
- mapValue:
899-
fields:
900-
res:
901-
functionValue:
902-
args:
903-
- fieldReferenceValue: __path__
904-
- stringValue: "projects/test/databases/(default)/documents"
905-
name: has_ancestor
906-
name: select
907851
- description: testReferenceSlice
908852
pipeline:
909853
- Collection: books

packages/google-cloud-firestore/tests/unit/v1/test_pipeline_expressions.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -967,25 +967,6 @@ def test_storage_size(self):
967967
infix_instance = arg1.storage_size()
968968
assert infix_instance == instance
969969

970-
def test_namespace(self):
971-
arg1 = self._make_arg("Input")
972-
instance = Expression.namespace(arg1)
973-
assert instance.name == "namespace"
974-
assert instance.params == [arg1]
975-
assert repr(instance) == "Input.namespace()"
976-
infix_instance = arg1.namespace()
977-
assert infix_instance == instance
978-
979-
def test_has_ancestor(self):
980-
arg1 = self._make_arg("Input")
981-
arg2 = self._make_arg("Ancestor")
982-
instance = Expression.has_ancestor(arg1, arg2)
983-
assert instance.name == "has_ancestor"
984-
assert instance.params == [arg1, arg2]
985-
assert repr(instance) == "Input.has_ancestor(Ancestor)"
986-
infix_instance = arg1.has_ancestor(arg2)
987-
assert infix_instance == instance
988-
989970
def test_reference_slice(self):
990971
arg1 = self._make_arg("Input")
991972
arg2 = self._make_arg("Start")
@@ -1751,7 +1732,7 @@ def test_array_transform(self):
17511732
]
17521733
assert (
17531734
repr(instance_with_idx)
1754-
== "ArrayField.array_transform(Constant.of('element_alias'), TransformExpr, Constant.of('index_alias'))"
1735+
== "ArrayField.array_transform(TransformExpr, Constant.of('element_alias'), Constant.of('index_alias'))"
17551736
)
17561737
infix_instance_with_idx = arg1.array_transform(arg3, arg2, arg4)
17571738
assert infix_instance_with_idx == instance_with_idx

0 commit comments

Comments
 (0)