File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 24
24
25
25
import six
26
26
27
+ from google .api .core .exceptions import PreconditionFailed
27
28
from google .cloud import bigquery
28
29
from google .cloud .bigquery .dataset import Dataset , DatasetReference
29
30
from google .cloud .bigquery .table import Table
@@ -158,7 +159,11 @@ def test_update_dataset(self):
158
159
ds3 = Config .CLIENT .update_dataset (ds2 , ['labels' ])
159
160
self .assertEqual (ds3 .labels , {'color' : 'green' , 'shape' : 'circle' })
160
161
161
- # TODO(jba): test that read-modify-write with ETag works.
162
+ # If we try to update using d2 again, it will fail because the
163
+ # previous update changed the ETag.
164
+ ds2 .description = 'no good'
165
+ with self .assertRaises (PreconditionFailed ):
166
+ Config .CLIENT .update_dataset (ds2 , ['description' ])
162
167
163
168
def test_list_datasets (self ):
164
169
datasets_to_create = [
You can’t perform that action at this time.
0 commit comments