File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 2424
2525import six
2626
27+ from google .api .core .exceptions import PreconditionFailed
2728from google .cloud import bigquery
2829from google .cloud .bigquery .dataset import Dataset , DatasetReference
2930from google .cloud .bigquery .table import Table
@@ -158,7 +159,11 @@ def test_update_dataset(self):
158159 ds3 = Config .CLIENT .update_dataset (ds2 , ['labels' ])
159160 self .assertEqual (ds3 .labels , {'color' : 'green' , 'shape' : 'circle' })
160161
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' ])
162167
163168 def test_list_datasets (self ):
164169 datasets_to_create = [
You can’t perform that action at this time.
0 commit comments