Example #1
0
 def tearDown(self):
     # - PER-TEST FIXTURES -
     #   put here any instructions you want to be run *AFTER* *EVERY* test is executed.
     if gbq.table_exists('pydata_pandas_bq_testing.new_test', PROJECT_ID):
         subprocess.call([
             'bq', 'rm', '-f',
             PROJECT_ID + ':pydata_pandas_bq_testing.new_test'
         ])
Example #2
0
    def test_create_bq_table(self):
        table_name = 'new_test6'

        test_schema = {'fields': [{'name': 'A', 'type': 'FLOAT'}, {'name': 'B', 'type': 'FLOAT'},
                                  {'name': 'C', 'type': 'STRING'}, {'name': 'D', 'type': 'TIMESTAMP'}]}

        gbq.create_table('pydata_pandas_bq_testing.' + table_name, test_schema, PROJECT_ID)

        self.assertTrue(gbq.table_exists('pydata_pandas_bq_testing.' + table_name, PROJECT_ID), 'Expected table to exist')
Example #3
0
    def tearDownClass(cls):
        # - GLOBAL CLASS FIXTURES -
        #   put here any instruction you want to execute only *ONCE* *AFTER* executing all tests.

        for i in range(1, 8):
            if gbq.table_exists('pydata_pandas_bq_testing.new_test' + str(i), PROJECT_ID):
                subprocess.call(['bq', 'rm', '-f', PROJECT_ID + ':pydata_pandas_bq_testing.new_test' + str(i)])

        subprocess.call(['bq', 'rm', '-f', PROJECT_ID + ':pydata_pandas_bq_testing'])
Example #4
0
 def test_table_does_not_exist(self):
     table_name = 'new_test7'
     self.assertTrue(not gbq.table_exists('pydata_pandas_bq_testing.' + table_name, PROJECT_ID),
                     'Expected table not to exist')
Example #5
0
 def tearDown(self):
     # - PER-TEST FIXTURES -
     #   put here any instructions you want to be run *AFTER* *EVERY* test is executed.
     if gbq.table_exists('pydata_pandas_bq_testing.new_test', PROJECT_ID):
         subprocess.call(['bq', 'rm', '-f', PROJECT_ID + ':pydata_pandas_bq_testing.new_test'])