7
7
import google .oauth2 .service_account
8
8
import numpy as np
9
9
import pandas
10
+ import pandas .api .types
10
11
import pandas .util .testing as tm
11
12
from pandas import DataFrame , NaT , compat
12
13
from pandas .compat import range , u
@@ -364,16 +365,16 @@ def test_should_properly_handle_arbitrary_datetime(self, project_id):
364
365
)
365
366
366
367
@pytest .mark .parametrize (
367
- "expression, type_ " ,
368
+ "expression, is_expected_dtype " ,
368
369
[
369
- ("current_date()" , "<M8[ns]" ),
370
- ("current_timestamp()" , "datetime64[ns]" ),
371
- ("current_datetime()" , "<M8[ns]" ),
372
- ("TRUE" , bool ),
373
- ("FALSE" , bool ),
370
+ ("current_date()" , pandas . api . types . is_datetime64_ns_dtype ),
371
+ ("current_timestamp()" , pandas . api . types . is_datetime64_ns_dtype ),
372
+ ("current_datetime()" , pandas . api . types . is_datetime64_ns_dtype ),
373
+ ("TRUE" , pandas . api . types . is_bool_dtype ),
374
+ ("FALSE" , pandas . api . types . is_bool_dtype ),
374
375
],
375
376
)
376
- def test_return_correct_types (self , project_id , expression , type_ ):
377
+ def test_return_correct_types (self , project_id , expression , is_expected_dtype ):
377
378
"""
378
379
All type checks can be added to this function using additional
379
380
parameters, rather than creating additional functions.
@@ -389,7 +390,7 @@ def test_return_correct_types(self, project_id, expression, type_):
389
390
credentials = self .credentials ,
390
391
dialect = "standard" ,
391
392
)
392
- assert df ["_" ].dtype == type_
393
+ assert is_expected_dtype ( df ["_" ].dtype )
393
394
394
395
def test_should_properly_handle_null_timestamp (self , project_id ):
395
396
query = "SELECT TIMESTAMP(NULL) AS null_timestamp"
0 commit comments