@@ -1137,13 +1137,7 @@ def test_get_second_response_in_empty_stream(self):
11371137
11381138 get_response = query .get ()
11391139 self .assertIsInstance (get_response , types .GeneratorType )
1140- with self .assertRaises (ValueError ) as exc_info :
1141- list (get_response )
1142-
1143- exc_args = exc_info .exception .args
1144- self .assertEqual (len (exc_args ), 3 )
1145- self .assertIs (exc_args [2 ], empty_response2 )
1146- self .assertIsNot (empty_response1 , empty_response2 )
1140+ self .assertEqual (list (get_response ), [])
11471141
11481142 # Verify the mock call.
11491143 parent_path , _ = parent ._parent_info ()
@@ -1193,8 +1187,6 @@ def test_get_with_skipped_results(self):
11931187 )
11941188
11951189 def test_get_empty_after_first_response (self ):
1196- from google .cloud .firestore_v1beta1 .query import _EMPTY_DOC_TEMPLATE
1197-
11981190 # Create a minimal fake GAPIC.
11991191 firestore_api = mock .Mock (spec = ["run_query" ])
12001192
@@ -1217,13 +1209,11 @@ def test_get_empty_after_first_response(self):
12171209 query = self ._make_one (parent )
12181210 get_response = query .get ()
12191211 self .assertIsInstance (get_response , types .GeneratorType )
1220- with self .assertRaises (ValueError ) as exc_info :
1221- list (get_response )
1222-
1223- exc_args = exc_info .exception .args
1224- self .assertEqual (len (exc_args ), 1 )
1225- msg = _EMPTY_DOC_TEMPLATE .format (1 , response_pb2 )
1226- self .assertEqual (exc_args [0 ], msg )
1212+ returned = list (get_response )
1213+ self .assertEqual (len (returned ), 1 )
1214+ snapshot = returned [0 ]
1215+ self .assertEqual (snapshot .reference ._path , ("charles" , "bark" ))
1216+ self .assertEqual (snapshot .to_dict (), data )
12271217
12281218 # Verify the mock call.
12291219 parent_path , _ = parent ._parent_info ()
@@ -1468,16 +1458,14 @@ def _call_fut(response_pb, collection, expected_prefix):
14681458
14691459 def test_empty (self ):
14701460 response_pb = _make_query_response ()
1471- snapshot , skipped_results = self ._call_fut (response_pb , None , None )
1461+ snapshot = self ._call_fut (response_pb , None , None )
14721462 self .assertIsNone (snapshot )
1473- self .assertEqual (skipped_results , 0 )
14741463
14751464 def test_after_offset (self ):
14761465 skipped_results = 410
14771466 response_pb = _make_query_response (skipped_results = skipped_results )
1478- snapshot , skipped_results = self ._call_fut (response_pb , None , None )
1467+ snapshot = self ._call_fut (response_pb , None , None )
14791468 self .assertIsNone (snapshot )
1480- self .assertEqual (skipped_results , skipped_results )
14811469
14821470 def test_response (self ):
14831471 from google .cloud .firestore_v1beta1 .document import DocumentSnapshot
@@ -1492,10 +1480,7 @@ def test_response(self):
14921480 data = {"a" : 901 , "b" : True }
14931481 response_pb = _make_query_response (name = name , data = data )
14941482
1495- snapshot , skipped_results = self ._call_fut (
1496- response_pb , collection , expected_prefix
1497- )
1498- self .assertEqual (skipped_results , 0 )
1483+ snapshot = self ._call_fut (response_pb , collection , expected_prefix )
14991484 self .assertIsInstance (snapshot , DocumentSnapshot )
15001485 expected_path = collection ._path + (doc_id ,)
15011486 self .assertEqual (snapshot .reference ._path , expected_path )
0 commit comments