Skip to content

Commit

Permalink
Rename methods for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPansino committed Jul 25, 2023
1 parent 6214f0b commit d17b62f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions tests/datastore_firestore/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def existing_document(collection, reset_firestore):
return doc


def _exercise_firestore(client, collection, existing_document):
def _exercise_client(client, collection, existing_document):
assert len(list(client.collections())) == 1
doc = list(client.get_all([existing_document]))[0]
assert doc.to_dict()["x"] == 1
Expand All @@ -56,7 +56,7 @@ def test_firestore_client(client, collection, existing_document):
)
@background_task(name="test_firestore_client")
def _test():
_exercise_firestore(client, collection, existing_document)
_exercise_client(client, collection, existing_document)

_test()

Expand All @@ -73,4 +73,4 @@ def test_firestore_client_generators(client, collection, assert_trace_for_genera
@validate_database_duration()
@background_task()
def test_firestore_client_db_duration(client, collection, existing_document):
_exercise_firestore(client, collection, existing_document)
_exercise_client(client, collection, existing_document)
6 changes: 3 additions & 3 deletions tests/datastore_firestore/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


def _exercise_firestore(collection):
def _exercise_collections(collection):
collection.document("DoesNotExist")
collection.add({"capital": "Rome", "currency": "Euro", "language": "Italian"}, "Italy")
collection.add({"capital": "Mexico City", "currency": "Peso", "language": "Spanish"}, "Mexico")
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_firestore_collections(collection):
)
@background_task(name="test_firestore_collections")
def _test():
_exercise_firestore(collection)
_exercise_collections(collection)

_test()

Expand All @@ -76,4 +76,4 @@ def test_firestore_collections_generators(collection, assert_trace_for_generator
@validate_database_duration()
@background_task()
def test_firestore_collections_db_duration(collection):
_exercise_firestore(collection)
_exercise_collections(collection)
6 changes: 3 additions & 3 deletions tests/datastore_firestore/test_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


def _exercise_firestore(collection):
def _exercise_documents(collection):
italy_doc = collection.document("Italy")
italy_doc.set({"capital": "Rome", "currency": "Euro", "language": "Italian"})
italy_doc.get()
Expand Down Expand Up @@ -67,7 +67,7 @@ def test_firestore_documents(collection):
)
@background_task(name="test_firestore_documents")
def _test():
_exercise_firestore(collection)
_exercise_documents(collection)

_test()

Expand All @@ -86,4 +86,4 @@ def test_firestore_documents_generators(collection, assert_trace_for_generator):
@validate_database_duration()
@background_task()
def test_firestore_documents_db_duration(collection):
_exercise_firestore(collection)
_exercise_documents(collection)
12 changes: 6 additions & 6 deletions tests/datastore_firestore/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def sample_data(collection, reset_firestore):

# ===== Query =====

def _exercise_firestore_query(collection):
def _exercise_query(collection):
query = collection.select("x").limit(10).order_by("x").where(field_path="x", op_string="<=", value=3)
assert len(query.get()) == 3
assert len(list(query.stream())) == 3
Expand All @@ -55,7 +55,7 @@ def test_firestore_query(collection):
)
@background_task(name="test_firestore_query")
def _test():
_exercise_firestore_query(collection)
_exercise_query(collection)

_test()

Expand All @@ -69,11 +69,11 @@ def test_firestore_query_generators(collection, assert_trace_for_generator):
@validate_database_duration()
@background_task()
def test_firestore_query_db_duration(collection):
_exercise_firestore_query(collection)
_exercise_query(collection)

# ===== AggregationQuery =====

def _exercise_firestore_aggregation(collection):
def _exercise_aggregation_query(collection):
aggregation_query = collection.select("x").where(field_path="x", op_string="<=", value=3).count()
assert aggregation_query.get()[0][0].value == 3
assert list(aggregation_query.stream())[0][0].value == 3
Expand All @@ -99,7 +99,7 @@ def test_firestore_aggregation_query(collection):
)
@background_task(name="test_firestore_aggregation_query")
def _test():
_exercise_firestore_aggregation(collection)
_exercise_aggregation_query(collection)

_test()

Expand All @@ -113,4 +113,4 @@ def test_firestore_aggregation_query_generators(collection, assert_trace_for_gen
@validate_database_duration()
@background_task()
def test_firestore_aggregation_query_db_duration(collection):
_exercise_firestore_aggregation(collection)
_exercise_aggregation_query(collection)

0 comments on commit d17b62f

Please sign in to comment.