1515import datetime
1616from unittest .mock import MagicMock
1717
18- import pytest
19-
2018import bigframes .bigquery .obj as obj
2119import bigframes .operations as ops
2220import bigframes .series as series
@@ -26,26 +24,31 @@ def test_fetch_metadata_op_structure():
2624 op = ops .obj_fetch_metadata_op
2725 assert op .name == "obj_fetch_metadata"
2826
27+
2928def test_get_access_url_op_structure ():
3029 op = ops .ObjGetAccessUrl (mode = "r" )
3130 assert op .name == "obj_get_access_url"
3231 assert op .mode == "r"
3332 assert op .duration is None
3433
34+
3535def test_get_access_url_with_duration_op_structure ():
3636 op = ops .ObjGetAccessUrl (mode = "rw" , duration = 3600000000 )
3737 assert op .name == "obj_get_access_url"
3838 assert op .mode == "rw"
3939 assert op .duration == 3600000000
4040
41+
4142def test_make_ref_op_structure ():
4243 op = ops .obj_make_ref_op
4344 assert op .name == "obj_make_ref"
4445
46+
4547def test_make_ref_json_op_structure ():
4648 op = ops .obj_make_ref_json_op
4749 assert op .name == "obj_make_ref_json"
4850
51+
4952def test_fetch_metadata_calls_apply_unary_op ():
5053 s = MagicMock (spec = series .Series )
5154
@@ -55,6 +58,7 @@ def test_fetch_metadata_calls_apply_unary_op():
5558 args , _ = s ._apply_unary_op .call_args
5659 assert args [0 ] == ops .obj_fetch_metadata_op
5760
61+
5862def test_get_access_url_calls_apply_unary_op_without_duration ():
5963 s = MagicMock (spec = series .Series )
6064
@@ -66,6 +70,7 @@ def test_get_access_url_calls_apply_unary_op_without_duration():
6670 assert args [0 ].mode == "r"
6771 assert args [0 ].duration is None
6872
73+
6974def test_get_access_url_calls_apply_unary_op_with_duration ():
7075 s = MagicMock (spec = series .Series )
7176 duration = datetime .timedelta (hours = 1 )
@@ -79,6 +84,7 @@ def test_get_access_url_calls_apply_unary_op_with_duration():
7984 # 1 hour = 3600 seconds = 3600 * 1000 * 1000 microseconds
8085 assert args [0 ].duration == 3600000000
8186
87+
8288def test_make_ref_calls_apply_binary_op_with_authorizer ():
8389 uri = MagicMock (spec = series .Series )
8490 auth = MagicMock (spec = series .Series )
@@ -90,6 +96,7 @@ def test_make_ref_calls_apply_binary_op_with_authorizer():
9096 assert args [0 ] == auth
9197 assert args [1 ] == ops .obj_make_ref_op
9298
99+
93100def test_make_ref_calls_apply_unary_op_without_authorizer ():
94101 json_val = MagicMock (spec = series .Series )
95102
0 commit comments