def test_query_dry_run_invalid(self):
        """Ensure that None and a dict is returned from the query when dry_run
        is True and the query is invalid.
        """

        mock_query_job = mock.Mock()

        mock_query_job.execute.side_effect = HttpError(
            'crap', '{"message": "Bad query"}'.encode('utf8'))

        self.mock_job_collection.query.return_value = mock_query_job

        job_id, results = self.client.query('%s blah' % self.query,
                                            dry_run=True)

        self.mock_job_collection.query.assert_called_once_with(
            projectId=self.project_id,
            body={'query': '%s blah' % self.query, 'timeoutMs': 0,
                  'maxResults': None,
                  'dryRun': True}
        )
        self.assertIsNone(job_id)
        self.assertEqual({'message': 'Bad query'}, results)
dataset/ETHPy150Open tylertreat/BigQuery-Python/bigquery/tests/test_client.py/TestQuery.test_query_dry_run_invalid/original