Skip to content

Commit 727de8b

Browse files
Saumitra ShahapureSaumitra Shahapure
authored andcommitted
Adding test case for zero rows.
1 parent e8005ee commit 727de8b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/io/tests/test_gbq.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ def test_download_dataset_larger_than_200k_rows(self):
296296
df = gbq.read_gbq("SELECT id FROM [publicdata:samples.wikipedia] GROUP EACH BY id ORDER BY id ASC LIMIT 200005", project_id=PROJECT_ID)
297297
self.assertEqual(len(df.drop_duplicates()), 200005)
298298

299+
def test_zero_rows(self):
300+
df = gbq.read_gbq("SELECT * FROM [publicdata:samples.wikipedia] where timestamp=-9999999", project_id=PROJECT_ID)
301+
tm.assertIs(df, DataFrame, "Zero rows result should be dataframe.")
302+
self.assertEqual(len(df), 0)
303+
304+
299305
class TestToGBQIntegration(tm.TestCase):
300306
# This class requires bq.py to be installed for setup/teardown.
301307
# It will also need to be preconfigured with a default dataset,

0 commit comments

Comments
 (0)