File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -284,16 +284,15 @@ def test_sample_uses_tablesample(
284284 mock_sample_with_tablesample , mock_gbq_connector , mock_bigquery_client
285285):
286286 mock_table = mock .Mock (spec = google .cloud .bigquery .Table )
287- mock_table .num_bytes = 10000
288- mock_table .num_rows = 100
289- mock_table .table_type = "TABLE"
290- mock_table .schema = [google .cloud .bigquery .SchemaField ("col1" , "INT64" )]
287+ type(mock_table ).table_type = mock .PropertyMock (return_value = "TABLE" )
288+ type(mock_table ).num_bytes = mock .PropertyMock (return_value = 1_000_000_000_000 )
289+ type(mock_table ).num_rows = mock .PropertyMock (return_value = 1_000 )
290+ type(mock_table ).schema = mock .PropertyMock (
291+ return_value = [google .cloud .bigquery .SchemaField ("col1" , "INT64" )]
292+ )
291293 mock_bigquery_client .get_table .return_value = mock_table
292294
293- with mock .patch (
294- "pandas_gbq.core.sample._calculate_target_bytes" , return_value = 1000
295- ):
296- pandas_gbq .core .sample .sample ("my-project.my_dataset.my_table" )
295+ pandas_gbq .core .sample .sample ("my-project.my_dataset.my_table" , target_mb = 1 )
297296
298297 mock_sample_with_tablesample .assert_called_once ()
299298
You can’t perform that action at this time.
0 commit comments