Skip to content

Commit eadb66e

Browse files
committed
updated system test
1 parent 0e205d8 commit eadb66e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/system/test_system.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,23 @@ def test_query_unary(client, cleanup, database):
15251525
assert len(data1) == 1
15261526
assert math.isnan(data1[field_name])
15271527

1528+
# 2. Query for not null
1529+
query2 = collection.where(filter=FieldFilter(field_name, "!=", None))
1530+
values2 = list(query2.stream())
1531+
assert len(values2) == 2
1532+
# should fetch documents 1 (NaN) and 2 (int)
1533+
assert any(snapshot.reference._path == document1._path for snapshot in values2)
1534+
assert any(snapshot.reference._path == document2._path for snapshot in values2)
1535+
1536+
# 3. Query for not NAN.
1537+
query3 = collection.where(filter=FieldFilter(field_name, "!=", nan_val))
1538+
values3 = list(query3.stream())
1539+
assert len(values3) == 1
1540+
snapshot3 = values3[0]
1541+
assert snapshot3.reference._path == document2._path
1542+
# only document2 is not NaN
1543+
assert snapshot3.to_dict() == {field_name: 123}
1544+
15281545

15291546
@pytest.mark.parametrize("database", [None, FIRESTORE_OTHER_DB], indirect=True)
15301547
def test_collection_group_queries(client, cleanup, database):

0 commit comments

Comments
 (0)