Skip to content

Commit 0b2376a

Browse files
committed
Make copy config tests more detailed
1 parent af4920b commit 0b2376a

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

tests/unit/job/test_copy.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ def _get_target_class():
2828

2929
return CopyJobConfig
3030

31+
def test_ctor_defaults(self):
32+
from google.cloud.bigquery.job import OperationType
33+
34+
config = self._make_one()
35+
36+
assert config.create_disposition is None
37+
assert config.write_disposition is None
38+
assert config.destination_encryption_configuration is None
39+
assert config.operation_type == OperationType.OPERATION_TYPE_UNSPECIFIED
40+
3141
def test_ctor_w_properties(self):
3242
from google.cloud.bigquery.job import CreateDisposition
3343
from google.cloud.bigquery.job import OperationType
@@ -76,19 +86,21 @@ def test_to_api_repr_with_encryption_none(self):
7686
resource, {"copy": {"destinationEncryptionConfiguration": None}}
7787
)
7888

79-
def test_operation_type_unspecified(self):
89+
def test_operation_type_setting_none(self):
8090
from google.cloud.bigquery.job import OperationType
8191

82-
config = self._make_one()
83-
self.assertEqual(
84-
config.operation_type, OperationType.OPERATION_TYPE_UNSPECIFIED
85-
)
92+
config = self._make_one(operation_type=OperationType.SNAPSHOT)
8693

8794
# Setting it to None is the same as setting it to OPERATION_TYPE_UNSPECIFIED.
8895
config.operation_type = None
89-
self.assertEqual(
90-
config.operation_type, OperationType.OPERATION_TYPE_UNSPECIFIED
91-
)
96+
assert config.operation_type == OperationType.OPERATION_TYPE_UNSPECIFIED
97+
98+
def test_operation_type_setting_non_none(self):
99+
from google.cloud.bigquery.job import OperationType
100+
101+
config = self._make_one(operation_type=None)
102+
config.operation_type = OperationType.RESTORE
103+
assert config.operation_type == OperationType.RESTORE
92104

93105

94106
class TestCopyJob(_Base):

0 commit comments

Comments
 (0)