Skip to content

Commit

Permalink
Updating BigQuery system test to verify timestamp handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Nov 30, 2015
1 parent 683fa95 commit c9ff0ed
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions system_tests/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,17 @@ def test_update_table(self):
self.assertEqual(found.mode, expected.mode)

def test_load_table_then_dump_table(self):
import datetime
from gcloud._helpers import UTC

NOW_SECONDS = 1448911495.484366
NOW = datetime.datetime.utcfromtimestamp(
NOW_SECONDS).replace(tzinfo=UTC)
ROWS = [
('Phred Phlyntstone', 32),
('Bharney Rhubble', 33),
('Wylma Phlyntstone', 29),
('Bhettye Rhubble', 27),
('Phred Phlyntstone', 32, NOW),
('Bharney Rhubble', 33, NOW + datetime.timedelta(seconds=10)),
('Wylma Phlyntstone', 29, NOW + datetime.timedelta(seconds=20)),
('Bhettye Rhubble', 27, None),
]
ROW_IDS = range(len(ROWS))
dataset = CLIENT.dataset(DATASET_NAME)
Expand All @@ -206,7 +212,8 @@ def test_load_table_then_dump_table(self):
full_name = bigquery.SchemaField('full_name', 'STRING',
mode='REQUIRED')
age = bigquery.SchemaField('age', 'INTEGER', mode='REQUIRED')
table = dataset.table(TABLE_NAME, schema=[full_name, age])
now = bigquery.SchemaField('now', 'TIMESTAMP')
table = dataset.table(TABLE_NAME, schema=[full_name, age, now])
self.assertFalse(table.exists())
table.create()
self.to_delete.insert(0, table)
Expand Down

0 comments on commit c9ff0ed

Please sign in to comment.