yohei1126 commented on a change in pull request #4324: [AIRFLOW-3327] Add 
support for location in BigQueryHook
URL: https://github.com/apache/incubator-airflow/pull/4324#discussion_r244590540
 
 

 ##########
 File path: tests/contrib/hooks/test_bigquery_hook.py
 ##########
 @@ -729,5 +702,21 @@ def test_legacy_sql_override_propagates_properly(self, 
run_with_config):
             self.assertIs(args[0]['query']['useLegacySql'], False)
 
 
+class TestBigQueryHookLocation(unittest.TestCase):
+    @mock.patch.object(hook.BigQueryBaseCursor, 'run_with_configuration')
+    def test_location_propagates_properly(self, run_with_config):
+        with mock.patch.object(hook.BigQueryHook, 'get_service'):
+            bq_hook = hook.BigQueryHook(location=None)
+            self.assertIsNone(bq_hook.location)
+
+            bq_cursor = hook.BigQueryBaseCursor(mock.Mock(),
+                                                'test-project',
+                                                location=None)
+            self.assertIsNone(bq_cursor.location)
+            bq_cursor.run_query(sql='select 1', location='US')
 
 Review comment:
   Why do you need to specify `location` on `run_query` after initialization of 
`BigQueryHook`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to